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->project->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')) {
39 $actioncode =
GETPOST(
'actioncode',
'array', 3);
40 if (!count($actioncode)) {
44 $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));
46 $search_agenda_label =
GETPOST(
'search_agenda_label');
48 $action =
GETPOST(
'action',
'alpha');
49 $confirm =
GETPOST(
'confirm',
'alpha');
55 $socid = $user->socid;
59 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
60 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
61 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
63 if (empty($page) || $page == -1) {
66 $offset = $limit * $page;
67 $pageprev = $page - 1;
68 $pagenext = $page + 1;
70 $sortfield =
'a.datep,a.id';
73 $sortorder =
'DESC,DESC';
77 $hookmanager->initHooks(array(
'agendacontract',
'globalcard'));
84 $parameters = array(
'id'=>$id);
85 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
90 if (empty($reshook)) {
92 if (
GETPOST(
'cancel',
'alpha') && !empty($backtopage)) {
93 header(
"Location: ".$backtopage);
98 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha')) {
100 $search_agenda_label =
'';
113 if (!empty($conf->project->enabled)) {
119 $module = (!empty($conf->global->CONTRACT_ADDON) ? $conf->global->CONTRACT_ADDON :
'mod_contract_serpis');
120 if (substr($module, 0, 13) ==
'mod_contract_' && substr($module, -3) ==
'php') {
121 $module = substr($module, 0,
dol_strlen($module) - 4);
125 $modCodeContract =
new $module();
128 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
129 require_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
132 $result = $object->fetch($id);
133 $object->fetch_thirdparty();
135 $title = $langs->trans(
"Agenda");
136 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/contractrefonly/', $conf->global->MAIN_HTML_TITLE) && $object->ref) {
137 $title = $object->ref.
" - ".$title;
141 if (!empty($conf->notification->enabled)) {
142 $langs->load(
"mails");
148 $linkback =
'<a href="'.DOL_URL_ROOT.
'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
151 if (!empty($modCodeContract->code_auto)) {
152 $morehtmlref .= $object->ref;
154 $morehtmlref .=
$form->editfieldkey(
"",
'ref', $object->ref, $object, $user->rights->contrat->creer,
'string',
'', 0, 3);
155 $morehtmlref .=
$form->editfieldval(
"",
'ref', $object->ref, $object, $user->rights->contrat->creer,
'string',
'', 0, 2);
160 $morehtmlref .=
'<div class="refidno">';
162 $morehtmlref .=
$form->editfieldkey(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, $permtoedit,
'string',
'', 0, 1);
163 $morehtmlref .=
$form->editfieldval(
"RefCustomer",
'ref_customer', $object->ref_customer, $object, $permtoedit,
'string',
'', null, null,
'', 1,
'getFormatedCustomerRef');
165 $morehtmlref .=
'<br>';
166 $morehtmlref .=
$form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $permtoedit,
'string',
'', 0, 1);
167 $morehtmlref .=
$form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, $permtoedit,
'string',
'', null, null,
'', 1,
'getFormatedSupplierRef');
169 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
170 if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) {
171 $morehtmlref .=
' (<a href="'.DOL_URL_ROOT.
'/contrat/list.php?socid='.$object->thirdparty->id.
'&search_name='.urlencode($object->thirdparty->name).
'">'.$langs->trans(
"OtherContracts").
'</a>)';
174 if (!empty($conf->project->enabled)) {
175 $langs->load(
"projects");
176 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
177 if ($user->rights->contrat->creer) {
178 if ($action !=
'classify') {
180 $morehtmlref .=
' : ';
182 if ($action ==
'classify') {
184 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
185 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
186 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
187 $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
188 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
189 $morehtmlref .=
'</form>';
191 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->thirdparty->id, $object->fk_project,
'none', 0, 0, 0, 1);
194 if (!empty($object->fk_project)) {
196 $proj->fetch($object->fk_project);
197 $morehtmlref .=
' : '.$proj->getNomUrl(1);
199 $morehtmlref .=
' - '.$proj->title;
206 $morehtmlref .=
'</div>';
208 dol_banner_tab($object,
'id', $linkback, 1,
'ref',
'none', $morehtmlref);
210 print
'<div class="fichecenter">';
212 print
'<div class="underbanner clearboth"></div>';
247 if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
248 $backtopage = $_SERVER[
'PHP_SELF'].
'?id='.$object->id;
249 $out =
'&origin='.$object->element.
'&originid='.$object->id.
'&backtopage='.urlencode($backtopage);
250 $newcardbutton .=
dolGetButtonTitle($langs->trans(
'AddAction'),
'',
'fa fa-plus-circle', DOL_URL_ROOT.
'/comm/action/card.php?action=create'.$out);
254 if (
isModEnabled(
'agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
258 if (!empty($contextpage) && $contextpage != $_SERVER[
"PHP_SELF"]) {
259 $param .=
'&contextpage='.$contextpage;
261 if ($limit > 0 && $limit != $conf->liste_limit) {
262 $param .=
'&limit='.$limit;
265 print
load_fiche_titre($langs->trans(
"ActionsOnContract"), $newcardbutton,
'');
270 $filters[
'search_agenda_label'] = $search_agenda_label;
273 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.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
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.
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.
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 from a POST of a form...
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, $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.
isModEnabled($module)
Is Dolibarr module enabled.
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.