Lines 67-73
BEGIN {
Link Here
|
67 |
|
67 |
|
68 |
CheckItemPreSave |
68 |
CheckItemPreSave |
69 |
|
69 |
|
70 |
GetItemStatus |
|
|
71 |
GetItemLocation |
70 |
GetItemLocation |
72 |
GetLostItems |
71 |
GetLostItems |
73 |
GetItemsForInventory |
72 |
GetItemsForInventory |
Lines 776-872
has copy-and-paste work.
Link Here
|
776 |
|
775 |
|
777 |
=cut |
776 |
=cut |
778 |
|
777 |
|
779 |
=head2 GetItemStatus |
|
|
780 |
|
781 |
$itemstatushash = GetItemStatus($fwkcode); |
782 |
|
783 |
Returns a list of valid values for the |
784 |
C<items.notforloan> field. |
785 |
|
786 |
NOTE: does B<not> return an individual item's |
787 |
status. |
788 |
|
789 |
Can be MARC dependent. |
790 |
fwkcode is optional. |
791 |
But basically could be can be loan or not |
792 |
Create a status selector with the following code |
793 |
|
794 |
=head3 in PERL SCRIPT |
795 |
|
796 |
my $itemstatushash = getitemstatus; |
797 |
my @itemstatusloop; |
798 |
foreach my $thisstatus (keys %$itemstatushash) { |
799 |
my %row =(value => $thisstatus, |
800 |
statusname => $itemstatushash->{$thisstatus}->{'statusname'}, |
801 |
); |
802 |
push @itemstatusloop, \%row; |
803 |
} |
804 |
$template->param(statusloop=>\@itemstatusloop); |
805 |
|
806 |
=head3 in TEMPLATE |
807 |
|
808 |
<select name="statusloop" id="statusloop"> |
809 |
<option value="">Default</option> |
810 |
[% FOREACH statusloo IN statusloop %] |
811 |
[% IF ( statusloo.selected ) %] |
812 |
<option value="[% statusloo.value %]" selected="selected">[% statusloo.statusname %]</option> |
813 |
[% ELSE %] |
814 |
<option value="[% statusloo.value %]">[% statusloo.statusname %]</option> |
815 |
[% END %] |
816 |
[% END %] |
817 |
</select> |
818 |
|
819 |
=cut |
820 |
|
821 |
sub GetItemStatus { |
822 |
|
823 |
# returns a reference to a hash of references to status... |
824 |
my ($fwk) = @_; |
825 |
my %itemstatus; |
826 |
my $dbh = C4::Context->dbh; |
827 |
my $sth; |
828 |
$fwk = '' unless ($fwk); |
829 |
my ( $tag, $subfield ) = |
830 |
GetMarcFromKohaField( "items.notforloan", $fwk ); |
831 |
if ( $tag and $subfield ) { |
832 |
my $sth = |
833 |
$dbh->prepare( |
834 |
"SELECT authorised_value |
835 |
FROM marc_subfield_structure |
836 |
WHERE tagfield=? |
837 |
AND tagsubfield=? |
838 |
AND frameworkcode=? |
839 |
" |
840 |
); |
841 |
$sth->execute( $tag, $subfield, $fwk ); |
842 |
if ( my ($authorisedvaluecat) = $sth->fetchrow ) { |
843 |
my $authvalsth = |
844 |
$dbh->prepare( |
845 |
"SELECT authorised_value,lib |
846 |
FROM authorised_values |
847 |
WHERE category=? |
848 |
ORDER BY lib |
849 |
" |
850 |
); |
851 |
$authvalsth->execute($authorisedvaluecat); |
852 |
while ( my ( $authorisedvalue, $lib ) = $authvalsth->fetchrow ) { |
853 |
$itemstatus{$authorisedvalue} = $lib; |
854 |
} |
855 |
return \%itemstatus; |
856 |
} |
857 |
else { |
858 |
|
859 |
#No authvalue list |
860 |
# build default |
861 |
} |
862 |
} |
863 |
|
864 |
#No authvalue list |
865 |
#build default |
866 |
$itemstatus{"1"} = "Not For Loan"; |
867 |
return \%itemstatus; |
868 |
} |
869 |
|
870 |
=head2 GetItemLocation |
778 |
=head2 GetItemLocation |
871 |
|
779 |
|
872 |
$itemlochash = GetItemLocation($fwk); |
780 |
$itemlochash = GetItemLocation($fwk); |
873 |
- |
|
|