Bug 36193: cud- treatment for tools/stockrotation.pl
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
98aeda6c54
commit
65c0c01161
2 changed files with 62 additions and 31 deletions
|
@ -147,14 +147,18 @@
|
|||
[% END %]
|
||||
</ul>
|
||||
</div>
|
||||
<a class="btn btn-default btn-xs" href="?op=toggle_rota&rota_id=[% rota.rota_id | uri %]">
|
||||
<i class="fa fa-power-off"></i>
|
||||
<form id="toggle_rota_[% rota.rota_id | html %]" method="post" action="/cgi-bin/koha/tools/stockrotation.pl">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-toggle_rota" />
|
||||
<input type="hidden" name="rota_id" value="[% rota.rota_id | html %]" />
|
||||
<button class="btn btn-default btn-xs" type="submit"><i class="fa fa-power-off"></i>
|
||||
[% IF !rota.active %]
|
||||
Activate
|
||||
[% ELSE %]
|
||||
Deactivate
|
||||
[% END %]
|
||||
</a>
|
||||
</button>
|
||||
</form>
|
||||
<a class="btn btn-default btn-xs" href="?op=confirm_delete_rota&rota_id=[% rota.rota_id | uri %]">
|
||||
<i class="fa fa-trash"></i>
|
||||
Delete
|
||||
|
@ -380,8 +384,15 @@
|
|||
<div class="dialog alert">
|
||||
<h1>Are you sure you wish to remove this item from its rota</h1>
|
||||
<p>
|
||||
<a class="btn btn-default btn-xs approve" href="?op=remove_item_from_stage&item_id=[% item_id | uri %]&stage_id=[% stage_id | uri %]&rota_id=[% rota_id | uri %]"><i class="fa fa-fw fa-check"></i>Yes</a>
|
||||
<a class="btn btn-default btn-xs deny" href="?op=manage_items&rota_id=[% rota_id | uri %]"><i class="fa fa-fw fa-times"></i>No</a>
|
||||
<form id="remove_item_from_stage_[% item_id | html %]_[% rota.rota_id | html %]" method="post" action="/cgi-bin/koha/tools/stockrotation.pl">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-remove_item_from_stage" />
|
||||
<input type="hidden" name="item_id" value="[% item_id | html %]" />
|
||||
<input type="hidden" name="rota_id" value="[% rota_id | html %]" />
|
||||
<input type="hidden" name="stage_id" value="[% stage_id | html %]" />
|
||||
<button class="btn btn-default btn-xs approve" type="submit"><i class="fa fa-fw fa-check"></i> Yes</button>
|
||||
</form>
|
||||
<a class="btn btn-default btn-xs deny" href="?op=manage_items&rota_id=[% rota_id | uri %]"><i class="fa fa-fw fa-times"></i> No</a>
|
||||
</p>
|
||||
</div>
|
||||
[% ELSIF (op == 'confirm_delete_rota') %]
|
||||
|
@ -396,8 +407,13 @@
|
|||
[% END %]
|
||||
[% END %]
|
||||
<p>
|
||||
<a class="btn btn-default btn-xs approve" href="?op=delete_rota&rota_id=[% rota_id | uri %]"><i class="fa fa-fw fa-check"></i>Yes</a>
|
||||
<a class="btn btn-default btn-xs deny" href="/cgi-bin/koha/tools/stockrotation.pl"><i class="fa fa-fw fa-times"></i>No</a>
|
||||
<form id="delete_rota_[% rota.rota_id | html %]" method="post" action="/cgi-bin/koha/tools/stockrotation.pl">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-delete_rota" />
|
||||
<input type="hidden" name="rota_id" value="[% rota.rota_id | html %]" />
|
||||
<button class="btn btn-default btn-xs approve" type="submit"><i class="fa fa-fw fa-check"></i> Yes</button>
|
||||
</form>
|
||||
<a class="btn btn-default btn-xs deny" href="/cgi-bin/koha/tools/stockrotation.pl"><i class="fa fa-fw fa-times"></i> No</a>
|
||||
</p>
|
||||
</div>
|
||||
[% ELSIF (op == 'confirm_delete_stage') %]
|
||||
|
@ -413,8 +429,13 @@
|
|||
</ul>
|
||||
[% END %]
|
||||
<p>
|
||||
<a class="btn btn-default btn-xs approve" href="?op=delete_stage&stage_id=[% stage.stage_id | uri %]"><i class="fa fa-fw fa-check"></i>Yes</a>
|
||||
<a class="btn btn-default btn-xs deny" href="?op=manage_stages&rota_id=[% stage.rota.rota_id | uri %]"><i class="fa fa-fw fa-times"></i>No</a>
|
||||
<form id="delete_stage_[% stage.stage_id | html %]" method="post" action="/cgi-bin/koha/tools/stockrotation.pl">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-delete_stage" />
|
||||
<input type="hidden" name="stage_id" value="[% stage.stage_id | html %]" />
|
||||
<button class="btn btn-default btn-xs approve" type="submit"><i class="fa fa-fw fa-check"></i> Yes</button>
|
||||
</form>
|
||||
<a class="btn btn-default btn-xs deny" href="?op=manage_stages&rota_id=[% stage.rota.rota_id | uri %]"><i class="fa fa-fw fa-times"></i> No</a>
|
||||
</p>
|
||||
</div>
|
||||
[% ELSIF (op == 'manage_items') %]
|
||||
|
@ -517,26 +538,36 @@
|
|||
[% in_transit = sritem.item.get_transfer %]
|
||||
[% IF stages.size < 2 %]
|
||||
<a class="btn btn-default btn-xs" title="Rota has a single stage, advancing will have no effect" disabled>
|
||||
[% ELSIF !in_transit %]
|
||||
<a class="btn btn-default btn-xs" href="?op=move_to_next_stage&rota_id=[% rota.id | uri %]&item_id=[% sritem.id | uri %]&stage_id=[% sritem.stage.stage_id | uri %]">
|
||||
[% ELSE %]
|
||||
<a class="btn btn-default btn-xs" href="?op=move_to_next_stage&rota_id=[% rota.id | uri %]&item_id=[% sritem.id | uri %]&stage_id=[% sritem.stage.stage_id | uri %]" title="Item is in transit, it will be directed to new stage when checked in">
|
||||
<form id="move_to_next_stage_[% sritem.id | html %]_[% rota.id | html %]" method="post" action="/cgi-bin/koha/tools/stockrotation.pl">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-move_to_next_stage" />
|
||||
<input type="hidden" name="item_id" value="[% sritem.id | html %]" />
|
||||
<input type="hidden" name="rota_id" value="[% rota.id | html %]" />
|
||||
<input type="hidden" name="stage_id" value="[% sritem.stage.stage_id | html %]" />
|
||||
[% IF !in_transit %]
|
||||
<button class="btn btn-default btn-xs" type="submit"><i class="fa fa-arrow-right"></i> Move to next stage</button>
|
||||
[% ELSE %]
|
||||
<button class="btn btn-default btn-xs" type="submit" title="Item is in transit, it will be directed to new stage when checked in"><i class="fa fa-arrow-right"></i> Move to next stage</button>
|
||||
[% END %]
|
||||
</form>
|
||||
[% END %]
|
||||
<i class="fa fa-arrow-right"></i>
|
||||
Move to next stage
|
||||
</a>
|
||||
|
||||
[% IF !in_transit %]
|
||||
<a class="btn btn-default btn-xs" href="?op=toggle_in_demand&stage_id=[% sritem.stage.stage_id | uri %]&item_id=[% sritem.id | uri %]&rota_id=[% rota.id | uri %]">
|
||||
[% ELSE %]
|
||||
<a class="btn btn-default btn-xs" disabled>
|
||||
<form id="toggle_in_demand_[% sritem.id | html %]_[% rota.id | html %]" method="post" action="/cgi-bin/koha/tools/stockrotation.pl">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-toggle_in_demand" />
|
||||
<input type="hidden" name="item_id" value="[% sritem.id | html %]" />
|
||||
<input type="hidden" name="rota_id" value="[% rota.id | html %]" />
|
||||
<input type="hidden" name="stage_id" value="[% sritem.stage.stage_id | html %]" />
|
||||
[% IF sritem.indemand %]
|
||||
<button class="btn btn-default btn-xs" type="submit"><i class="fa fa-fire"></i> Remove "In demand"</button>
|
||||
[% ELSE %]
|
||||
<button class="btn btn-default btn-xs" type="submit"><i class="fa fa-fire"></i> Add "In demand"</button>
|
||||
[% END %]
|
||||
</form>
|
||||
[% END %]
|
||||
<i class="fa fa-fire"></i>
|
||||
[% IF sritem.indemand %]
|
||||
<span>Remove "In demand"</span>
|
||||
[% ELSE %]
|
||||
<span>Add "In demand"</span>
|
||||
[% END %]
|
||||
</a>
|
||||
|
||||
[% IF !in_transit %]
|
||||
<a class="btn btn-default btn-xs" href="?op=confirm_remove_from_rota&stage_id=[% sritem.stage.stage_id | uri %]&item_id=[% sritem.id | uri %]&rota_id=[% rota.id | uri %]">
|
||||
[% ELSE %]
|
||||
|
|
|
@ -107,7 +107,7 @@ if (!defined $op) {
|
|||
op => $op
|
||||
);
|
||||
|
||||
} elsif ($op eq 'toggle_rota') {
|
||||
} elsif ($op eq 'cud-toggle_rota') {
|
||||
|
||||
# Find and update the active status of the rota
|
||||
my $rota = Koha::StockRotationRotas->find($params{rota_id});
|
||||
|
@ -223,7 +223,7 @@ if (!defined $op) {
|
|||
op => $op
|
||||
);
|
||||
|
||||
} elsif ($op eq 'delete_rota') {
|
||||
} elsif ($op eq 'cud-delete_rota') {
|
||||
|
||||
# Get the rota we're deleting
|
||||
my $rota = Koha::StockRotationRotas->find($params{rota_id});
|
||||
|
@ -243,7 +243,7 @@ if (!defined $op) {
|
|||
stage => $stage
|
||||
);
|
||||
|
||||
} elsif ($op eq 'delete_stage') {
|
||||
} elsif ($op eq 'cud-delete_stage') {
|
||||
|
||||
# Get the stage we're deleting
|
||||
my $stage = Koha::StockRotationStages->find($params{stage_id});
|
||||
|
@ -315,14 +315,14 @@ if (!defined $op) {
|
|||
op => $op
|
||||
);
|
||||
|
||||
} elsif ($op eq 'move_to_next_stage') {
|
||||
} elsif ($op eq 'cud-move_to_next_stage') {
|
||||
|
||||
move_to_next_stage($params{item_id}, $params{stage_id});
|
||||
|
||||
# Return to the items list
|
||||
print $input->redirect("?op=manage_items&rota_id=" . $params{rota_id});
|
||||
|
||||
} elsif ($op eq 'toggle_in_demand') {
|
||||
} elsif ($op eq 'cud-toggle_in_demand') {
|
||||
|
||||
# Toggle the item's in_demand
|
||||
toggle_indemand($params{item_id}, $params{stage_id});
|
||||
|
@ -330,7 +330,7 @@ if (!defined $op) {
|
|||
# Return to the items list
|
||||
print $input->redirect("?op=manage_items&rota_id=".$params{rota_id});
|
||||
|
||||
} elsif ($op eq 'remove_item_from_stage') {
|
||||
} elsif ($op eq 'cud-remove_item_from_stage') {
|
||||
|
||||
# Remove the item from the stage
|
||||
remove_from_stage($params{item_id}, $params{stage_id});
|
||||
|
|
Loading…
Reference in a new issue