Go to the documentation of this file.
28 require
'../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/order.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
37 $langs->loadLangs(array(
'orders',
'sendings',
'companies',
'bills'));
41 $action =
GETPOST(
'action',
'aZ09');
45 $socid = $user->socid;
55 if ($action ==
'addcontact' && $user->rights->commande->creer) {
56 $result = $object->fetch($id);
58 if ($result > 0 && $id > 0) {
61 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
65 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
68 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
69 $langs->load(
"errors");
70 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"),
null,
'errors');
75 } elseif ($action ==
'swapstatut' && $user->rights->commande->creer) {
77 if ($object->fetch($id)) {
78 $result = $object->swapContactStatus(
GETPOST(
'ligne',
'int'));
82 } elseif ($action ==
'deletecontact' && $user->rights->commande->creer) {
85 $result = $object->delete_contact(
GETPOST(
"lineid",
'int'));
88 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
99 $title = $langs->trans(
'Order').
" - ".$langs->trans(
'ContactsAddresses');
100 $help_url =
'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
106 $contactstatic =
new Contact($db);
107 $userstatic =
new User($db);
116 if ($id > 0 || !empty($ref)) {
117 if ($object->fetch($id, $ref) > 0) {
118 $object->fetch_thirdparty();
121 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"CustomerOrder"), -1,
'order');
125 $linkback =
'<a href="'.DOL_URL_ROOT.
'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
127 $morehtmlref =
'<div class="refidno">';
129 $morehtmlref .=
$form->editfieldkey(
"RefCustomer",
'ref_client', $object->ref_client, $object, 0,
'string',
'', 0, 1);
130 $morehtmlref .=
$form->editfieldval(
"RefCustomer",
'ref_client', $object->ref_client, $object, 0,
'string',
'',
null,
null,
'', 1);
132 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
134 if (!empty($conf->project->enabled)) {
135 $langs->load(
"projects");
136 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
137 if ($user->rights->commande->creer) {
138 if ($action !=
'classify') {
140 $morehtmlref .=
' : ';
142 if ($action ==
'classify') {
144 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
145 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
146 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
147 $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
148 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
149 $morehtmlref .=
'</form>';
151 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->thirdparty->id, $object->fk_project,
'none', 0, 0, 0, 1);
154 if (!empty($object->fk_project)) {
156 $proj->fetch($object->fk_project);
157 $morehtmlref .=
' : '.$proj->getNomUrl(1);
159 $morehtmlref .=
' - '.$proj->title;
166 $morehtmlref .=
'</div>';
168 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
175 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
176 foreach ($dirtpls as $reldir) {
184 print
"ErrorRecordNotFound";
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.
Class to manage projects.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
commande_prepare_head(Commande $object)
Prepare array with list of tabs.
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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.
if(GETPOST('button_removefilter_x', 'alpha')||GETPOST('button_removefilter.x', 'alpha')||GETPOST('button_removefilter', 'alpha')) if(GETPOST('button_search_x', 'alpha')||GETPOST('button_search.x', 'alpha')||GETPOST('button_search', 'alpha')) if($action=="save" &&empty($cancel)) $help_url
View.
Class to manage customers orders.
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.
Class to manage Dolibarr users.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.