[Koha-patches] [PATCH] Cleanup circulation.pl
Joe Atzberger
joe.atzberger at liblime.com
Wed May 27 04:53:23 CEST 2009
The presentation is unchanged. The elsifs are appropriate because during
any one pass of the foreach loop, $flag will still only have one value.
During other passes, additional $template parameters are being set for other
values of $flag, but never more that one chunk of the if/elsif conditional
per pass.
--Joe
On Tue, May 26, 2009 at 6:19 PM, Michael Hafen <mdhafen at tech.washk12.org>wrote:
> Speaking for myself, I'd rather have all of the flags presented in one
> go, otherwise we'd have fixed one issue after another. I'd rather know
> up front what all needs to be fixed. Just my two cents.
>
> Thanks for the good work.
>
> On Tue, 2009-05-26 at 16:41 -0500, Joe Atzberger wrote:
> > Removed many unused variables.
> > Switched to elsif where appropriate.
> > Cleaned up some whitespace.
> > Corrected comments.
> > ---
> > circ/circulation.pl | 79
> +++++++++++++++++++-------------------------------
> > 1 files changed, 30 insertions(+), 49 deletions(-)
> >
> > diff --git a/circ/circulation.pl b/circ/circulation.pl
> > index d40429f..99f9210 100755
> > --- a/circ/circulation.pl
> > +++ b/circ/circulation.pl
> [snip]
> > @@ -547,9 +533,7 @@ if ($borrowerslist) {
> >
> > #title
> > my $flags = $borrower->{'flags'};
> > -my $flag;
> > -
> > -foreach $flag ( sort keys %$flags ) {
> > +foreach my $flag ( sort keys %$flags ) {
> > $template->param( flagged=> 1);
> > $flags->{$flag}->{'message'} =~ s#\n#<br />#g;
> > if ( $flags->{$flag}->{'noissues'} ) {
> > @@ -560,13 +544,13 @@ foreach $flag ( sort keys %$flags ) {
> > if ( $flag eq 'GNA' ) {
> > $template->param( gna => 'true' );
> > }
> > - if ( $flag eq 'LOST' ) {
> > + elsif ( $flag eq 'LOST' ) {
> > $template->param( lost => 'true' );
> > }
> > - if ( $flag eq 'DBARRED' ) {
> > + elsif ( $flag eq 'DBARRED' ) {
> > $template->param( dbarred => 'true' );
> > }
> > - if ( $flag eq 'CHARGES' ) {
> > + elsif ( $flag eq 'CHARGES' ) {
> > $template->param(
> > charges => 'true',
> > chargesmsg => $flags->{'CHARGES'}->{'message'},
> > @@ -574,7 +558,7 @@ foreach $flag ( sort keys %$flags ) {
> > charges_is_blocker => 1
> > );
> > }
> > - if ( $flag eq 'CREDITS' ) {
> > + elsif ( $flag eq 'CREDITS' ) {
> > $template->param(
> > credits => 'true',
> > creditsmsg => $flags->{'CREDITS'}->{'message'}
> > @@ -590,13 +574,13 @@ foreach $flag ( sort keys %$flags ) {
> > chargesamount => $flags->{'CHARGES'}->{'amount'},
> > );
> > }
> > - if ( $flag eq 'CREDITS' ) {
> > + elsif ( $flag eq 'CREDITS' ) {
> > $template->param(
> > credits => 'true',
> > creditsmsg => $flags->{'CREDITS'}->{'message'}
> > );
> > }
> > - if ( $flag eq 'ODUES' ) {
> > + elsif ( $flag eq 'ODUES' ) {
> > $template->param(
> > odues => 'true',
> > flagged => 1,
> > @@ -613,11 +597,11 @@ foreach $flag ( sort keys %$flags ) {
> > # push @itemswaiting, $iteminformation;
> > # }
> > # }
> > - if ( $query->param('module') ne 'returns' ) {
> > + if ( ! $query->param('module') or $query->param('module') ne
> 'returns' ) {
> > $template->param( nonreturns => 'true' );
> > }
> > }
> > - if ( $flag eq 'NOTES' ) {
> > + elsif ( $flag eq 'NOTES' ) {
> > $template->param(
> > notes => 'true',
> > flagged => 1,
> [snip]
> --
> Michael Hafen
> Systems Analyst and Programmer
> Washington County School District
> Utah, USA
>
> for Koha checkout
> http://development.washk12.org/gitweb/
> or
> git://development.washk12.org/koha
>
>
>
--
Joe Atzberger
LibLime - Open Source Library Solutions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/koha-patches/attachments/20090526/c4aa045a/attachment-0001.htm>
More information about the Koha-patches
mailing list