27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/contract.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
30 if (!empty($conf->projet->enabled)) {
31 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
35 $langs->loadLangs(array(
'companies',
'contracts'));
37 $action =
GETPOST(
'action',
'aZ09');
38 $confirm =
GETPOST(
'confirm',
'alpha');
39 $socid =
GETPOST(
'socid',
'int');
44 if ($user->socid) $socid = $user->socid;
48 $object->fetch($id, $ref);
50 $permissionnote = $user->rights->contrat->creer;
53 $hookmanager->initHooks(array(
'contractcard',
'globalcard'));
61 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
69 llxHeader(
'', $langs->trans(
"Contract"),
"");
71 $form =
new Form($db);
73 if ($id > 0 || !empty($ref))
75 $object->fetch_thirdparty();
85 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contrat/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
90 $morehtmlref .= $object->ref;
96 $morehtmlref .=
'<div class="refidno">';
98 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, 0,
'string',
'', 0, 1);
99 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, 0,
'string',
'', null, null,
'', 1,
'getFormatedCustomerRef');
101 $morehtmlref .=
'<br>';
102 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', 0, 1);
103 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', null, null,
'', 1,
'getFormatedSupplierRef');
105 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
107 if (!empty($conf->projet->enabled))
109 $langs->load(
"projects");
110 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
111 if ($user->rights->contrat->creer)
113 if ($action !=
'classify')
115 $morehtmlref .=
' : ';
116 if ($action ==
'classify') {
118 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
119 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
120 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
121 $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
122 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
123 $morehtmlref .=
'</form>';
125 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->thirdparty->id, $object->fk_project,
'none', 0, 0, 0, 1);
128 if (!empty($object->fk_project)) {
130 $proj->fetch($object->fk_project);
131 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
132 $morehtmlref .= $proj->ref;
133 $morehtmlref .=
'</a>';
139 $morehtmlref .=
'</div>';
142 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'none', $morehtmlref);
145 print '<div class="fichecenter">';
146 print '<div class="underbanner clearboth"></div>';
148 print '<table class="border centpercent tableforfield">';
152 print '<tr><td class="titlefield">'.$langs->trans(
'Discount').
'</td><td colspan="3">';
153 if ($object->thirdparty->remise_percent)
print $langs->trans(
"CompanyHasRelativeDiscount", $object->thirdparty->remise_percent);
154 else print $langs->trans(
"CompanyHasNoRelativeDiscount");
155 $absolute_discount = $object->thirdparty->getAvailableDiscounts();
157 if ($absolute_discount)
print $langs->trans(
"CompanyHasAbsoluteDiscount",
price($absolute_discount), $langs->trans(
"Currency".$conf->currency));
158 else print $langs->trans(
"CompanyHasNoAbsoluteDiscount");
164 print '<td class="titlefield">';
165 print $form->editfieldkey(
"Date",
'date_contrat', $object->date_contrat, $object, 0);
167 print $form->editfieldval(
"Date",
'date_contrat', $object->date_contrat, $object, 0,
'datehourpicker');
177 include DOL_DOCUMENT_ROOT.
'/core/tpl/notes.tpl.php';
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage contracts.
contract_prepare_head(Contrat $object)
Prepare array with list of tabs.
price($amount, $form=0, $outlangs= '', $trunc=1, $rounding=-1, $forcerounding=-1, $currency_code= '')
Function to format a value into an amount for visual output Function used into PDF and HTML pages...
Class to manage projects.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0)
Check permissions of a user to show a page and an object.
print $_SERVER["PHP_SELF"]
Edit parameters.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
print
Draft customers invoices.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
dol_banner_tab($object, $paramid, $morehtml= '', $shownav=1, $fieldid= 'rowid', $fieldref= 'ref', $morehtmlref= '', $moreparam= '', $nodbprefix=0, $morehtmlleft= '', $morehtmlstatus= '', $onlybanner=0, $morehtmlright= '')
Show tab footer of a card.