Bug 7606: Editing a vendor in acq creates a new vendor
authorKatrin Fischer <Katrin.Fischer.83@web.de>
Sun, 26 Feb 2012 14:14:27 +0000 (15:14 +0100)
committerPaul Poulain <paul.poulain@biblibre.com>
Mon, 27 Feb 2012 10:14:48 +0000 (11:14 +0100)
To test:

Before patch:
- editing a new vendor will create a new vendor

After patch:
- editing a vendor saves changes correctly, no new vendor is created

Also:
- after saving or cancelling an edit page redirects correctly
- adding new vendors works correctly

Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Followed test plan and all tests pass.

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This is a follow-up for 7113

acqui/updatesupplier.pl
koha-tmpl/intranet-tmpl/prog/en/modules/acqui/supplier.tt

index 3e79362..844e504 100755 (executable)
@@ -66,10 +66,10 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user(
 );
 
 #print $input->header();
-my $supplier=$input->param('supplier');
+my $booksellerid=$input->param('booksellerid');
 #print startpage;
 my %data;
-$data{'booksellerid'}=$input->param('booksellerid');
+$data{'id'}=$booksellerid;
 
 $data{'name'}=$input->param('company');
 $data{'postal'}=$input->param('company_postal');
@@ -109,13 +109,13 @@ if ($gstrate eq '') {
 $data{'discount'}=$input->param('discount');
 $data{'active'}=$input->param('status');
 if($data{'name'}) {
-       if ($data{'booksellerid'}){
+       if ($data{'id'}){
            ModBookseller(\%data);
        } else {
-           $data{booksellerid}=AddBookseller(\%data);
+           $data{id}=AddBookseller(\%data);
        }
 #redirect to booksellers.pl
-print $input->redirect("booksellers.pl?booksellerid=".$data{booksellerid});
+print $input->redirect("booksellers.pl?booksellerid=".$data{id});
 } else {
 print $input->redirect("supplier.pl?op=enter"); # fail silently.
 }
index d4bfe72..05b7fac 100644 (file)
@@ -39,7 +39,7 @@ if (f.company.value == "") {
 [% IF ( enter ) %]
     <form action="updatesupplier.pl" name="updatesupplier" method="post">
     <div class="yui-g">
-        <input type="hidden" name="id" value="[% booksellerid %]" />
+        <input type="hidden" name="booksellerid" value="[% booksellerid %]" />
         <fieldset class="rows">
             <legend>Company details</legend>
             <ol><li><label for="company" class="required">Name * </label>