27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/order.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
36 $langs->loadLangs(array(
'orders',
'sendings',
'companies'));
40 $action=
GETPOST(
'action',
'alpha');
43 if ($user->societe_id) $socid=$user->societe_id;
52 if ($action ==
'addcontact' && $user->rights->commande->creer)
54 $result = $object->fetch($id);
56 if ($result > 0 && $id > 0)
59 $result = $object->add_contact($contactid, $_POST[
"type"], $_POST[
"source"]);
64 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
69 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS')
71 $langs->load(
"errors");
72 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"), null,
'errors');
82 else if ($action ==
'swapstatut' && $user->rights->commande->creer)
84 if ($object->fetch($id))
86 $result=$object->swapContactStatus(
GETPOST(
'ligne'));
95 else if ($action ==
'deletecontact' && $user->rights->commande->creer)
98 $result = $object->delete_contact($_GET[
"lineid"]);
102 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
122 llxHeader(
'',$langs->trans(
'Order'),
'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes');
124 $form =
new Form($db);
127 $contactstatic=
new Contact($db);
128 $userstatic=
new User($db);
137 if ($id > 0 || ! empty($ref))
139 $langs->trans(
"OrderCard");
141 if ($object->fetch($id, $ref) > 0)
143 $object->fetch_thirdparty();
146 dol_fiche_head($head,
'contact', $langs->trans(
"CustomerOrder"), -1,
'order');
151 $linkback =
'<a href="' . DOL_URL_ROOT .
'/commande/list.php?restore_lastsearch_values=1' . (! empty($socid) ?
'&socid=' . $socid :
'') .
'">' . $langs->trans(
"BackToList") .
'</a>';
154 $morehtmlref=
'<div class="refidno">';
156 $morehtmlref.=$form->editfieldkey(
"RefCustomer",
'ref_client', $object->ref_client, $object, 0,
'string',
'', 0, 1);
157 $morehtmlref.=$form->editfieldval(
"RefCustomer",
'ref_client', $object->ref_client, $object, 0,
'string',
'', null, null,
'', 1);
159 $morehtmlref.=
'<br>'.$langs->trans(
'ThirdParty') .
' : ' . $object->thirdparty->getNomUrl(1);
161 if (! empty($conf->projet->enabled))
163 $langs->load(
"projects");
164 $morehtmlref.=
'<br>'.$langs->trans(
'Project') .
' ';
165 if ($user->rights->commande->creer)
167 if ($action !=
'classify')
170 if ($action ==
'classify') {
172 $morehtmlref.=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
173 $morehtmlref.=
'<input type="hidden" name="action" value="classin">';
174 $morehtmlref.=
'<input type="hidden" name="token" value="'.$_SESSION[
'newtoken'].
'">';
175 $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
176 $morehtmlref.=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
177 $morehtmlref.=
'</form>';
179 $morehtmlref.=$form->form_project($_SERVER[
'PHP_SELF'] .
'?id=' . $object->id, $object->thirdparty->id, $object->fk_project,
'none', 0, 0, 0, 1);
182 if (! empty($object->fk_project)) {
184 $proj->fetch($object->fk_project);
185 $morehtmlref.=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id=' . $object->fk_project .
'" title="' . $langs->trans(
'ShowProject') .
'">';
186 $morehtmlref.=$proj->ref;
187 $morehtmlref.=
'</a>';
193 $morehtmlref.=
'</div>';
195 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
202 $dirtpls=array_merge($conf->modules_parts[
'tpl'],array(
'/core/tpl'));
203 foreach($dirtpls as $reldir)
212 print "ErrorRecordNotFound";
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
setEventMessages($mesg, $mesgs, $style='mesgs')
Set event messages in dol_events session object.
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.
Class to manage Dolibarr users.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Class to manage projects.
dol_fiche_end($notab=0)
Show tab footer of a card.
Class to manage customers orders.
commande_prepare_head(Commande $object)
Prepare array with list of tabs.
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.
dol_fiche_head($links=array(), $active='0', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='')
Show tab header of a card.