MT2345 : Changes on contracts

This commit is contained in:
Matthias Meusburger 2009-12-28 11:21:49 +01:00 committed by Henri-Damien LAURENT
parent c85e22ad53
commit 0b5cc8f809
6 changed files with 47 additions and 15 deletions

View File

@ -43,8 +43,10 @@ To know the bookseller this script has to display details.
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;
@ -66,8 +68,23 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user(
);
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'},
@ -97,6 +114,7 @@ if ($op eq "display") {
listprice => $booksellers[0]->{'listprice'},
GST => $GST,
basketcount => $booksellers[0]->{'basketcount'},
contracts => \@contracts
);
}
elsif ($op eq 'delete') {

View File

@ -98,7 +98,7 @@ elsif ( $op eq 'add_validate' ) {
});
}
print $input->redirect("aqcontract.pl?booksellerid=$booksellerid");
print $input->redirect("/cgi-bin/koha/acqui/supplier.pl?supplierid=$booksellerid");
exit;
# END $OP eq ADD_VALIDATE
@ -125,7 +125,7 @@ elsif ( $op eq 'delete_confirmed' ) {
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

View File

@ -44,7 +44,6 @@
<!-- TMPL_IF NAME="id" -->
<li><a id="editsupplier" href="/cgi-bin/koha/acqui/supplier.pl?supplierid=<!--TMPL_VAR Name="id"-->&amp;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 -->

View File

@ -143,7 +143,7 @@
<!-- 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&amp;contractnumber=<!-- TMPL_VAR NAME="basketcontractno" -->"><!-- TMPL_VAR NAME="basketcontractname" --></a></p>
<p>Contract name: <a href="../admin/aqcontract.pl?op=add_form&amp;contractnumber=<!-- TMPL_VAR NAME="basketcontractno" -->&amp;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 -->

View File

@ -202,6 +202,32 @@ if (f.company.value == "") {
<!-- 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">&nbsp; </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&amp;contractnumber=<!-- TMPL_VAR NAME="contractnumber" -->&amp;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&amp;contractnumber=<!-- TMPL_VAR NAME="contractnumber" -->&amp;booksellerid=<!-- TMPL_VAR name="booksellerid" -->">Edit</a></td>
<td><a href="/cgi-bin/koha/admin/aqcontract.pl?op=delete_confirm&amp;contractnumber=<!-- TMPL_VAR NAME="contractnumber" -->&amp;booksellerid=<!-- TMPL_VAR name="booksellerid" -->">Delete</a></td>
</tr>
<!-- /TMPL_LOOP -->
</table>
<!-- /TMPL_IF -->
<!--/TMPL_IF-->
</div>

View File

@ -108,17 +108,6 @@ function Check(ff) {
<li><label for="contractdescription">Description</label> &nbsp;
<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> &nbsp;
<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" />