25 require
"../main.inc.php";
26 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
27 require_once DOL_DOCUMENT_ROOT.
'/core/lib/contract.lib.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.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';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
36 $langs->loadLangs(array(
"companies",
"contracts"));
38 if (
GETPOST(
'actioncode',
'array'))
40 $actioncode =
GETPOST(
'actioncode',
'array', 3);
41 if (!count($actioncode)) $actioncode =
'0';
43 $actioncode =
GETPOST(
"actioncode",
"alpha", 3) ?
GETPOST(
"actioncode",
"alpha", 3) : (
GETPOST(
"actioncode") ==
'0' ?
'0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ?
'' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
45 $search_agenda_label =
GETPOST(
'search_agenda_label');
47 $action =
GETPOST(
'action',
'alpha');
48 $confirm =
GETPOST(
'confirm',
'alpha');
53 if ($user->socid) $socid = $user->socid;
56 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
57 $sortfield =
GETPOST(
"sortfield",
'alpha');
58 $sortorder =
GETPOST(
"sortorder",
'alpha');
60 if (empty($page) || $page == -1) { $page = 0; }
61 $offset = $limit * $page;
62 $pageprev = $page - 1;
63 $pagenext = $page + 1;
64 if (!$sortfield) $sortfield =
'a.datep,a.id';
65 if (!$sortorder) $sortorder =
'DESC,DESC';
68 $hookmanager->initHooks(array(
'agendacontract',
'globalcard'));
75 $parameters = array(
'id'=>$id);
76 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
77 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
82 if (
GETPOST(
'cancel',
'alpha') && !empty($backtopage))
84 header(
"Location: ".$backtopage);
89 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
92 $search_agenda_label =
'';
103 $form =
new Form($db);
105 if (!empty($conf->projet->enabled)) $formproject =
new FormProjets($db);
110 $module = (!empty($conf->global->CONTRACT_ADDON) ? $conf->global->CONTRACT_ADDON :
'mod_contract_serpis');
111 if (substr($module, 0, 13) ==
'mod_contract_' && substr($module, -3) ==
'php')
113 $module = substr($module, 0,
dol_strlen($module) - 4);
118 $modCodeContract =
new $module();
121 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
122 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
125 $result = $object->fetch($id);
126 $object->fetch_thirdparty();
128 $title = $langs->trans(
"Agenda");
129 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/contractrefonly/', $conf->global->MAIN_HTML_TITLE) && $object->ref) $title = $object->ref.
" - ".$title;
132 if (!empty($conf->notification->enabled)) $langs->load(
"mails");
137 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
140 if (!empty($modCodeContract->code_auto)) {
141 $morehtmlref .= $object->ref;
143 $morehtmlref .= $form->editfieldkey(
"",
'ref', $object->ref, $object, $user->rights->contrat->creer,
'string',
'', 0, 3);
144 $morehtmlref .= $form->editfieldval(
"",
'ref', $object->ref, $object, $user->rights->contrat->creer,
'string',
'', 0, 2);
149 $morehtmlref .=
'<div class="refidno">';
151 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, $permtoedit,
'string',
'', 0, 1);
152 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, $permtoedit,
'string',
'', null, null,
'', 1,
'getFormatedCustomerRef');
154 $morehtmlref .=
'<br>';
155 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $permtoedit,
'string',
'', 0, 1);
156 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $permtoedit,
'string',
'', null, null,
'', 1,
'getFormatedSupplierRef');
158 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
159 if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref .=
' (<a href="'.DOL_URL_ROOT.
'/contrat/list.php?socid='.$object->thirdparty->id.
'&search_name='.urlencode($object->thirdparty->name).
'">'.$langs->trans(
"OtherContracts").
'</a>)';
161 if (!empty($conf->projet->enabled))
163 $langs->load(
"projects");
164 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
165 if ($user->rights->contrat->creer)
167 if ($action !=
'classify') {
169 $morehtmlref .=
' : ';
171 if ($action ==
'classify') {
173 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
174 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
175 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
176 $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
177 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
178 $morehtmlref .=
'</form>';
180 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->thirdparty->id, $object->fk_project,
'none', 0, 0, 0, 1);
183 if (!empty($object->fk_project)) {
185 $proj->fetch($object->fk_project);
186 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
187 $morehtmlref .= $proj->ref;
188 $morehtmlref .=
'</a>';
194 $morehtmlref .=
'</div>';
196 dol_banner_tab($object,
'id', $linkback, 1,
'ref',
'none', $morehtmlref);
198 print '<div class="fichecenter">';
200 print '<div class="underbanner clearboth"></div>';
234 if (!empty($conf->agenda->enabled))
236 if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create))
238 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/comm/action/card.php?action=create'.$out);
242 if (!empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read)))
247 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.$contextpage;
248 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.$limit;
255 $filters[
'search_agenda_label'] = $search_agenda_label;
258 show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode,
'', $filters, $sortfield, $sortorder);
if(!function_exists('dol_getprefix')) dol_include_once($relpath, $classname= '')
Make an include_once using default root and alternate root if it fails.
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dolGetButtonTitle($label, $helpText= '', $iconClass= 'fa fa-file', $url= '', $id= '', $status=1, $params=array())
Function dolGetButtonTitle : this kind of buttons are used in title in list.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
Class to manage contracts.
show_actions_done($conf, $langs, $db, $filterobj, $objcon= '', $noprint=0, $actioncode= '', $donetodo= 'done', $filters=array(), $sortfield= 'a.datep, a.id', $sortorder= 'DESC', $module= '')
Show html area with actions (done or not, ignore the name of function).
contract_prepare_head(Contrat $object)
Prepare array with list of tabs.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname.
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
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.