Bugzilla – Attachment 34789 Details for
Bug 11023
Automatic item modification by age (Was "Toggle new status for items")
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11023: Rename the duration parameter with 'age'
Bug-11023-Rename-the-duration-parameter-with-age.patch (text/plain), 8.85 KB, created by
Jonathan Druart
on 2014-12-29 10:22:40 UTC
(
hide
)
Description:
Bug 11023: Rename the duration parameter with 'age'
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2014-12-29 10:22:40 UTC
Size:
8.85 KB
patch
obsolete
>From c7b716621f87cc8ac5e2553abb2922fe38e7ef2f Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 23 Sep 2014 10:02:08 +0200 >Subject: [PATCH] Bug 11023: Rename the duration parameter with 'age' > >--- > C4/Items.pm | 6 ++-- > .../prog/en/modules/tools/toggle_new_status.tt | 24 ++++++++-------- > t/db_dependent/Items/ToggleNewStatus.t | 32 +++++++++++----------- > tools/toggle_new_status.pl | 2 +- > 4 files changed, 32 insertions(+), 32 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 8e8cd16..bebbb13 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -3099,7 +3099,7 @@ sub ToggleNewStatus { > my @biblioitem_columns = map { "biblioitems.$_" } C4::Items::biblioitems_columns; > my $report; > for my $rule ( @rules ) { >- my $duration = $rule->{duration}; >+ my $age = $rule->{age}; > my $conditions = $rule->{conditions}; > my $substitutions = $rule->{substitutions}; > my @params; >@@ -3127,9 +3127,9 @@ sub ToggleNewStatus { > } > } > } >- if ( defined $duration ) { >+ if ( defined $age ) { > $query .= q| AND TO_DAYS(NOW()) - TO_DAYS(dateaccessioned) >= ? |; >- push @params, $duration; >+ push @params, $age; > } > my $sth = $dbh->prepare($query); > $sth->execute( @params ); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/toggle_new_status.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/toggle_new_status.tt >index 7791d6f..f9aa6ce 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/toggle_new_status.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/toggle_new_status.tt >@@ -65,7 +65,7 @@ > $(new_rule).find("select[name='substitution_field']").attr('name', 'substitution_field_' + unique_id); > $(new_rule).find("input[name='condition_value']").attr('name', 'condition_value_' + unique_id); > $(new_rule).find("input[name='substitution_value']").attr('name', 'substitution_value_' + unique_id); >- $(new_rule).find("input[name='duration']").attr('name', 'duration_' + unique_id); >+ $(new_rule).find("input[name='age']").attr('name', 'age_' + unique_id); > $(new_rule).find("input[name='unique_id']").val(unique_id); > > $("#rules").append(new_rule); >@@ -145,9 +145,9 @@ > [% SET id = loop.count %] > <div class="rule"> > <input type="hidden" name="unique_id" value="[% loop.count %]" /> <!-- FIXME on update, the unique_id should be filled --> >- <div class="duration"> >- <h5>Duration</h5> >- <input type="text" value="[% rule.duration %]" name="duration_[% id %]" /> days >+ <div class="age"> >+ <h5>Age</h5> >+ <input type="type" value="[% rule.age %]" name="age_[% id %]" /> days > </div> > <div class="blocks"> > <h5>Conditions</h5> >@@ -208,9 +208,9 @@ > <h4>Add a new rule</h4> > <div id="new_rule"> > <input type="hidden" name="unique_id" /> >- <div class="duration"> >- <h5>Duration</h5> >- <input type="text" value="" name="duration" /> days >+ <div class="age"> >+ <h5>Age</h5> >+ <input type="text" value="" name="age" /> days > </div> > <div class="blocks"> > <h5>Conditions</h5> >@@ -250,12 +250,12 @@ > <h4>List of rules</h4> > [% FOR rule IN rules %] > <div class="rule"> >- <div class="duration"> >- <h5>Duration</h5> >- [% IF rule.duration.defined and rule.duration.length > 0 %] >- [% rule.duration %] days >+ <div class="age"> >+ <h5>Age</h5> >+ [% IF rule.age.defined and rule.age.length > 0 %] >+ [% rule.age %] days > [% ELSE %] >- There is no duration for this rule. >+ There is no age for this rule. > [% END %] > </div> > <div class="blocks"> >diff --git a/t/db_dependent/Items/ToggleNewStatus.t b/t/db_dependent/Items/ToggleNewStatus.t >index 40d8e4a..3f2943c 100644 >--- a/t/db_dependent/Items/ToggleNewStatus.t >+++ b/t/db_dependent/Items/ToggleNewStatus.t >@@ -67,7 +67,7 @@ my @rules = ( > value => 'updated_value', > }, > ], >- duration => '0', >+ age => '0', > }, > ); > >@@ -93,7 +93,7 @@ is( $marc_item->subfield($tagfield, $new_tagfield), 'updated_value', q|ToggleNew > value => 'new_updated_value', > }, > ], >- duration => '0', >+ age => '0', > }, > ); > >@@ -104,7 +104,7 @@ is( $modified_item->{new}, 'updated_value', q|ToggleNewStatus: The new value is > $marc_item = C4::Items::GetMarcItem( $biblionumber, $itemnumber ); > is( $marc_item->subfield($tagfield, $new_tagfield), 'updated_value', q|ToggleNewStatus: The new value is not updated| ); > >-# Play with duration >+# Play with age > $item = C4::Items::GetItem( $itemnumber ); > my $dt_today = dt_from_string; > my $days5ago = $dt_today->add_duration( DateTime::Duration->new( days => -5 ) ); >@@ -126,30 +126,30 @@ $item = C4::Items::GetItem( $itemnumber ); > value => 'new_updated_value', > }, > ], >- duration => '10', >+ age => '10', > }, > ); > C4::Items::ToggleNewStatus( { rules => \@rules } ); > $modified_item = C4::Items::GetItem( $itemnumber ); >-is( $modified_item->{new}, 'updated_value', q|ToggleNewStatus: Duration = 10 : The new value is not updated|); >+is( $modified_item->{new}, 'updated_value', q|ToggleNewStatus: Age = 10 : The new value is not updated|); > >-$rules[0]->{duration} = 5; >+$rules[0]->{age} = 5; > $rules[0]->{substitutions}[0]{value} = 'new_updated_value5'; > C4::Items::ToggleNewStatus( { rules => \@rules } ); > $modified_item = C4::Items::GetItem( $itemnumber ); >-is( $modified_item->{new}, 'new_updated_value5', q|ToggleNewStatus: Duration = 5 : The new value is updated|); >+is( $modified_item->{new}, 'new_updated_value5', q|ToggleNewStatus: Age = 5 : The new value is updated|); > >-$rules[0]->{duration} = ''; >+$rules[0]->{age} = ''; > $rules[0]->{substitutions}[0]{value} = 'new_updated_value_empty_string'; > C4::Items::ToggleNewStatus( { rules => \@rules } ); > $modified_item = C4::Items::GetItem( $itemnumber ); >-is( $modified_item->{new}, 'new_updated_value_empty_string', q|ToggleNewStatus: Duration = '' : The new value is updated|); >+is( $modified_item->{new}, 'new_updated_value_empty_string', q|ToggleNewStatus: Age = '' : The new value is updated|); > >-$rules[0]->{duration} = undef; >+$rules[0]->{age} = undef; > $rules[0]->{substitutions}[0]{value} = 'new_updated_value_undef'; > C4::Items::ToggleNewStatus( { rules => \@rules } ); > $modified_item = C4::Items::GetItem( $itemnumber ); >-is( $modified_item->{new}, 'new_updated_value_undef', q|ToggleNewStatus: Duration = undef : The new value is updated|); >+is( $modified_item->{new}, 'new_updated_value_undef', q|ToggleNewStatus: Age = undef : The new value is updated|); > > # Field deletion > @rules = ( >@@ -166,7 +166,7 @@ is( $modified_item->{new}, 'new_updated_value_undef', q|ToggleNewStatus: Duratio > value => '', > }, > ], >- duration => '0', >+ age => '0', > }, > ); > >@@ -196,7 +196,7 @@ is( $marc_item->subfield($tagfield, $new_tagfield), undef, q|ToggleNewStatus: Th > value => 'new_value', > }, > ], >- duration => '0', >+ age => '0', > }, > ); > >@@ -223,7 +223,7 @@ is( $modified_item->{new}, 'new_value', q|ToggleNewStatus: conditions multiple: > value => 'new_updated_value', > }, > ], >- duration => '0', >+ age => '0', > }, > ); > >@@ -250,7 +250,7 @@ is( $modified_item->{new}, 'new_value', q|ToggleNewStatus: conditions multiple: > value => 'new_updated_value', > }, > ], >- duration => '0', >+ age => '0', > }, > ); > >@@ -273,7 +273,7 @@ is( $modified_item->{new}, 'new_updated_value', q|ToggleNewStatus: conditions mu > value => 'another_new_updated_value', > }, > ], >- duration => '0', >+ age => '0', > }, > ); > >diff --git a/tools/toggle_new_status.pl b/tools/toggle_new_status.pl >index a37ea1a..9d4c590 100755 >--- a/tools/toggle_new_status.pl >+++ b/tools/toggle_new_status.pl >@@ -82,7 +82,7 @@ if ( $op eq 'update' ) { > } > push @{ $rule->{conditions} }, {} > unless @{ $rule->{conditions} }; >- $rule->{duration} = $cgi->param("duration_$unique_id"); >+ $rule->{age} = $cgi->param("age_$unique_id"); > push @rules, $rule; > } > my $syspref_content = to_json( \@rules ); >-- >2.1.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11023
:
21926
|
21932
|
21982
|
21983
|
22004
|
22386
|
22734
|
22735
|
24068
|
24069
|
24070
|
24146
|
24147
|
24148
|
25767
|
25833
|
26817
|
26818
|
26819
|
26820
|
26821
|
26822
|
26855
|
27810
|
29216
|
29217
|
29218
|
29219
|
29220
|
29221
|
29222
|
31820
|
31821
|
31822
|
33226
|
33227
|
33228
|
33229
|
33230
|
33231
|
33232
|
33233
|
33234
|
33235
|
34782
|
34783
|
34784
|
34785
|
34786
|
34787
|
34788
|
34789
|
34790
|
34791
|
34870
|
34871
|
34872
|
34873
|
34874
|
34875
|
34876
|
34877
|
34878
|
34879
|
34880
|
34881
|
34882
|
34883
|
35375
|
35376
|
41147
|
41148