Lines 1863-1869
sub _koha_new_item {
Link Here
|
1863 |
|
1863 |
|
1864 |
=head2 MoveItemFromBiblio |
1864 |
=head2 MoveItemFromBiblio |
1865 |
|
1865 |
|
1866 |
MoveItemFromBiblio($itenumber, $frombiblio, $tobiblio); |
1866 |
MoveItemFromBiblio($itenumber, $frombiblio, $tobiblio, $bibliotoindex); |
1867 |
|
1867 |
|
1868 |
Moves an item from a biblio to another |
1868 |
Moves an item from a biblio to another |
1869 |
|
1869 |
|
Lines 1879-1914
sub MoveItemFromBiblio {
Link Here
|
1879 |
FROM biblioitems |
1879 |
FROM biblioitems |
1880 |
WHERE biblionumber = ? |
1880 |
WHERE biblionumber = ? |
1881 |
|, undef, $tobiblio ); |
1881 |
|, undef, $tobiblio ); |
1882 |
my $return = $dbh->do(q| |
|
|
1883 |
UPDATE items |
1884 |
SET biblioitemnumber = ?, |
1885 |
biblionumber = ? |
1886 |
WHERE itemnumber = ? |
1887 |
AND biblionumber = ? |
1888 |
|, undef, $tobiblioitem, $tobiblio, $itemnumber, $frombiblio ); |
1889 |
if ($return == 1) { |
1890 |
ModZebra( $tobiblio, "specialUpdate", "biblioserver" ); |
1891 |
ModZebra( $frombiblio, "specialUpdate", "biblioserver" ); |
1892 |
# Checking if the item we want to move is in an order |
1893 |
require C4::Acquisition; |
1894 |
my $order = C4::Acquisition::GetOrderFromItemnumber($itemnumber); |
1895 |
if ($order) { |
1896 |
# Replacing the biblionumber within the order if necessary |
1897 |
$order->{'biblionumber'} = $tobiblio; |
1898 |
C4::Acquisition::ModOrder($order); |
1899 |
} |
1900 |
|
1882 |
|
1901 |
# Update reserves, hold_fill_targets, tmp_holdsqueue and linktracker tables |
1883 |
if ( defined $_[3]) { |
1902 |
for my $table_name ( qw( reserves hold_fill_targets tmp_holdsqueue linktracker ) ) { |
1884 |
my $bibliotoindex = $_[3]; |
1903 |
$dbh->do( qq| |
1885 |
if ($bibliotoindex eq "new") { |
1904 |
UPDATE $table_name |
1886 |
my $return = $dbh->do(q| |
1905 |
SET biblionumber = ? |
1887 |
UPDATE items |
|
|
1888 |
SET biblioitemnumber = ?, |
1889 |
biblionumber = ? |
1906 |
WHERE itemnumber = ? |
1890 |
WHERE itemnumber = ? |
1907 |
|, undef, $tobiblio, $itemnumber ); |
1891 |
AND biblionumber = ? |
|
|
1892 |
|, undef, $tobiblioitem, $tobiblio, $itemnumber, $frombiblio ); |
1893 |
if ($return == 1) { |
1894 |
ModZebra( $tobiblio, "specialUpdate", "biblioserver" ); |
1895 |
# Checking if the item we want to move is in an order |
1896 |
require C4::Acquisition; |
1897 |
my $order = C4::Acquisition::GetOrderFromItemnumber($itemnumber); |
1898 |
if ($order) { |
1899 |
# Replacing the biblionumber within the order if necessary |
1900 |
$order->{'biblionumber'} = $tobiblio; |
1901 |
C4::Acquisition::ModOrder($order); |
1902 |
} |
1903 |
|
1904 |
# Update reserves, hold_fill_targets, tmp_holdsqueue and linktracker tables |
1905 |
for my $table_name ( qw( reserves hold_fill_targets tmp_holdsqueue linktracker ) ) { |
1906 |
$dbh->do( qq| |
1907 |
UPDATE $table_name |
1908 |
SET biblionumber = ? |
1909 |
WHERE itemnumber = ? |
1910 |
|, undef, $tobiblio, $itemnumber ); |
1911 |
} |
1912 |
return $tobiblio; |
1913 |
} |
1914 |
} elsif ($bibliotoindex eq "old") { |
1915 |
ModZebra( $frombiblio, "specialUpdate", "biblioserver" ); |
1916 |
return 1; |
1908 |
} |
1917 |
} |
1909 |
return $tobiblio; |
1918 |
} else { |
1910 |
} |
1919 |
my $return = $dbh->do(q| |
1911 |
return; |
1920 |
UPDATE items |
|
|
1921 |
SET biblioitemnumber = ?, |
1922 |
biblionumber = ? |
1923 |
WHERE itemnumber = ? |
1924 |
AND biblionumber = ? |
1925 |
|, undef, $tobiblioitem, $tobiblio, $itemnumber, $frombiblio ); |
1926 |
if ($return == 1) { |
1927 |
ModZebra( $tobiblio, "specialUpdate", "biblioserver" ); |
1928 |
ModZebra( $frombiblio, "specialUpdate", "biblioserver" ); |
1929 |
# Checking if the item we want to move is in an order |
1930 |
require C4::Acquisition; |
1931 |
my $order = C4::Acquisition::GetOrderFromItemnumber($itemnumber); |
1932 |
if ($order) { |
1933 |
# Replacing the biblionumber within the order if necessary |
1934 |
$order->{'biblionumber'} = $tobiblio; |
1935 |
C4::Acquisition::ModOrder($order); |
1936 |
} |
1937 |
# Update reserves, hold_fill_targets, tmp_holdsqueue and linktracker tables |
1938 |
for my $table_name ( qw( reserves hold_fill_targets tmp_holdsqueue linktracker ) ) { |
1939 |
$dbh->do( qq| |
1940 |
UPDATE $table_name |
1941 |
SET biblionumber = ? |
1942 |
WHERE itemnumber = ? |
1943 |
|, undef, $tobiblio, $itemnumber ); |
1944 |
} |
1945 |
return $tobiblio; |
1946 |
} |
1947 |
return; |
1948 |
} |
1912 |
} |
1949 |
} |
1913 |
|
1950 |
|
1914 |
=head2 ItemSafeToDelete |
1951 |
=head2 ItemSafeToDelete |