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->project->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');
45 $socid = $user->socid;
49 $hookmanager->initHooks(array(
'contractnote'));
54 $object->fetch($id, $ref);
56 $permissionnote = $user->rights->contrat->creer;
63 $reshook = $hookmanager->executeHooks(
'doActions', array(), $object, $action);
67 if (empty($reshook)) {
68 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
77 llxHeader(
'', $langs->trans(
"Contract"),
"");
81 if ($id > 0 || !empty($ref)) {
82 $object->fetch_thirdparty();
92 $linkback =
'<a href="'.DOL_URL_ROOT.
'/contrat/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
97 $morehtmlref .= $object->ref;
103 $morehtmlref .=
'<div class="refidno">';
105 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, 0,
'string',
'', 0, 1);
106 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, 0,
'string',
'', null, null,
'', 1,
'getFormatedCustomerRef');
108 $morehtmlref .=
'<br>';
109 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', 0, 1);
110 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', null, null,
'', 1,
'getFormatedSupplierRef');
112 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
114 if (!empty($conf->project->enabled)) {
115 $langs->load(
"projects");
116 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
117 if ($user->rights->contrat->creer) {
118 if ($action !=
'classify') {
120 $morehtmlref .=
' : ';
122 if ($action ==
'classify') {
124 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
125 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
126 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
127 $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
128 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
129 $morehtmlref .=
'</form>';
131 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->thirdparty->id, $object->fk_project,
'none', 0, 0, 0, 1);
134 if (!empty($object->fk_project)) {
136 $proj->fetch($object->fk_project);
137 $morehtmlref .=
' : '.$proj->getNomUrl(1);
139 $morehtmlref .=
' - '.$proj->title;
146 $morehtmlref .=
'</div>';
149 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'none', $morehtmlref);
152 print
'<div class="fichecenter">';
153 print
'<div class="underbanner clearboth"></div>';
155 print
'<table class="border centpercent tableforfield">';
159 print
'<tr><td class="titlefield">'.$langs->trans(
'Discount').
'</td><td colspan="3">';
160 if ($object->thirdparty->remise_percent) {
161 print $langs->trans(
"CompanyHasRelativeDiscount", $object->thirdparty->remise_percent);
163 print $langs->trans(
"CompanyHasNoRelativeDiscount");
165 $absolute_discount = $object->thirdparty->getAvailableDiscounts();
167 if ($absolute_discount) {
168 print $langs->trans(
"CompanyHasAbsoluteDiscount",
price($absolute_discount), $langs->trans(
"Currency".$conf->currency));
170 print $langs->trans(
"CompanyHasNoAbsoluteDiscount");
177 print
'<td class="titlefield">';
178 print $form->editfieldkey(
"Date",
'date_contrat', $object->date_contrat, $object, 0);
180 print $form->editfieldval(
"Date",
'date_contrat', $object->date_contrat, $object, 0,
'datehourpicker');
190 $cssclass=
'titlefield';
191 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.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
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...
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage projects.
restrictedArea($user, $features, $objectid=0, $tableandshare= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
dol_get_fiche_head($links=array(), $active= '', $title= '', $notab=0, $picto= '', $pictoisfullpath=0, $morehtmlright= '', $morecss= '', $limittoshow=0, $moretabssuffix= '')
Show tabs of a record.
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.