use strict;
use C4::Auth;
use C4::Acquisition;
+use C4::Contract;
use C4::Biblio;
use C4::Output;
+use C4::Dates qw/format_date /;
use CGI;
use C4::Bookseller;
);
my $GST = $booksellers[0]->{'gstrate'} || C4::Context->preference("gist");
$GST *= 100;
+
+my @contracts = GetContracts($id);
+my $contractcount = scalar(@contracts);
+$template->param(hascontracts => 1) if ($contractcount > 0);
+
#build array for currencies
if ($op eq "display") {
+
+ # get contracts
+ my @contracts = @{GetContract( { booksellerid => $id } )};
+
+ # format dates
+ for ( @contracts ) {
+ $$_{contractstartdate} = format_date($$_{contractstartdate});
+ $$_{contractenddate} = format_date($$_{contractenddate});
+ }
+
$template->param(
id => $id,
name => $booksellers[0]->{'name'},
listprice => $booksellers[0]->{'listprice'},
GST => $GST,
basketcount => $booksellers[0]->{'basketcount'},
+ contracts => \@contracts
);
}
elsif ($op eq 'delete') {
});
}
- print $input->redirect("aqcontract.pl?booksellerid=$booksellerid");
+ print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?supplierid=$booksellerid");
exit;
# END $OP eq ADD_VALIDATE
DelContract( { contractnumber => $contractnumber } );
- print $input->redirect("aqcontract.pl?booksellerid=$booksellerid");
+ print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?supplierid=$booksellerid");
exit;
# END $OP eq DELETE_CONFIRMED
<!-- TMPL_IF NAME="id" -->
<li><a id="editsupplier" href="/cgi-bin/koha/acqui/supplier.pl?supplierid=<!--TMPL_VAR Name="id"-->&op=enter">Edit</a></li>
<li><a id="newcontract" href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&booksellerid=<!-- TMPL_VAR name="id" -->">New Contract</a></li>
- <li><a id="editcontracts" href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=<!-- TMPL_VAR name="id" -->">Contracts</a></li>
<!-- TMPL_UNLESS NAME="basketcount" -->
<li><a id="newbasket" href="/cgi-bin/koha/admin/aqcontract.pl?booksellerid=<!-- TMPL_VAR name="id" -->">New Basket</a></li>
<!-- /TMPL_UNLESS -->
<!-- TMPL_IF NAME="basketbooksellernote" --><p>Vendor note: <!-- TMPL_VAR NAME="basketbooksellernote" --></p><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="basketcontractno" -->
<p>Contract number: <!-- TMPL_VAR NAME="basketcontractno" --></p>
- <p>Contract name: <a href="../admin/aqcontract.pl?op=add_form&contractnumber=<!-- TMPL_VAR NAME="basketcontractno" -->"><!-- TMPL_VAR NAME="basketcontractname" --></a></p>
+ <p>Contract name: <a href="../admin/aqcontract.pl?op=add_form&contractnumber=<!-- TMPL_VAR NAME="basketcontractno" -->&booksellerid=<!-- TMPL_VAR NAME="booksellerid" -->"><!-- TMPL_VAR NAME="basketcontractname" --></a></p>
<!-- /TMPL_IF -->
<!-- TMPL_IF NAME="authorisedbyname" --><p>Managed by: <!-- TMPL_VAR NAME="authorisedbyname" --></p><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="creationdate" --><p>Open on: <!-- TMPL_VAR NAME="creationdate" --></p><!-- /TMPL_IF -->
<!-- TMPL_IF NAME="notes" --><p><strong>Notes: </strong>
<!-- TMPL_VAR NAME="notes" --></p><!-- /TMPL_IF -->
</div>
+
+ <!-- TMPL_IF name="contracts" -->
+ <h3>Contract(s)</h3>
+ <table>
+ <tr>
+ <th scope="col">Name</th>
+ <th scope="col">Description</th>
+ <th scope="col">Start date</th>
+ <th scope="col">End date</th>
+ <th scope="col" colspan="2"> </th>
+ </tr>
+ <!-- TMPL_LOOP NAME="contracts" -->
+ <!-- TMPL_IF NAME="__even__" --><tr class="highlight"><!-- TMPL_ELSE --><tr><!-- /TMPL_IF -->
+ <td>
+ <a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=<!-- TMPL_VAR NAME="contractnumber" -->&booksellerid=<!-- TMPL_VAR name="booksellerid" -->"><!-- TMPL_VAR NAME="contractname" --></a>
+ </td>
+ <td><!-- TMPL_VAR NAME="contractdescription" --></td>
+ <td><!-- TMPL_VAR NAME="contractstartdate" --></td>
+ <td><!-- TMPL_VAR NAME="contractenddate" --></td>
+ <td><a href="/cgi-bin/koha/admin/aqcontract.pl?op=add_form&contractnumber=<!-- TMPL_VAR NAME="contractnumber" -->&booksellerid=<!-- TMPL_VAR name="booksellerid" -->">Edit</a></td>
+ <td><a href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&contractnumber=<!-- TMPL_VAR NAME="contractnumber" -->&booksellerid=<!-- TMPL_VAR name="booksellerid" -->">Delete</a></td>
+ </tr>
+ <!-- /TMPL_LOOP -->
+ </table>
+ <!-- /TMPL_IF -->
+
<!--/TMPL_IF-->
</div>
<li><label for="contractdescription">Description</label>
<input type="text" name="contractdescription" id="contractdescription" size="40" maxlength="80" value="<!-- TMPL_VAR NAME="contractdescription" -->" />
</li>
- <li><label for="booksellerid">Vendor</label>
- <select id="booksellerid" name="booksellerid">
- <!-- TMPL_LOOP NAME="booksellerloop" -->
- <!-- TMPL_IF NAME="selected" -->
- <option value="<!-- TMPL_VAR NAME="id" -->" selected="selected"><!-- TMPL_VAR NAME="name" --></option>
- <!-- TMPL_ELSE -->
- <option value="<!-- TMPL_VAR NAME="id" -->"><!-- TMPL_VAR NAME="name" --></option>
- <!-- /TMPL_IF -->
- <!-- /TMPL_LOOP -->
- </select>
- </li>
<li><label for="contractstartdate" class="required">Start date *</label>
<input type="text" name="contractstartdate" id="contractstartdate" value="<!-- TMPL_VAR NAME="contractstartdate" -->" maxlength="10" size="10"/>
<img src="<!-- TMPL_VAR Name="themelang" -->/lib/calendar/cal.gif" id="contractstartdate_button" alt="Show Calendar" />