26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/expedition/class/expedition.class.php';
28 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/sendings.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
32 if (!empty($conf->projet->enabled)) {
33 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
38 $langs->loadLangs(array(
'orders',
'sendings',
'companies'));
42 $action =
GETPOST(
'action',
'aZ09');
45 if ($user->socid) $socid = $user->socid;
49 if ($id > 0 || !empty($ref))
51 $object->fetch($id, $ref);
52 $object->fetch_thirdparty();
54 if (!empty($object->origin))
56 $typeobject = $object->origin;
57 $origin = $object->origin;
58 $object->fetch_origin();
62 if ($typeobject ==
'commande' && $object->$typeobject->id && !empty($conf->commande->enabled))
65 $objectsrc->fetch($object->$typeobject->id);
67 if ($typeobject ==
'propal' && $object->$typeobject->id && !empty($conf->propal->enabled))
69 $objectsrc =
new Propal($db);
70 $objectsrc->fetch($object->$typeobject->id);
79 if ($action ==
'addcontact' && $user->rights->expedition->creer)
81 if ($result > 0 && $id > 0)
85 $result = $objectsrc->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
90 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
93 if ($objectsrc->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS')
95 $langs->load(
"errors");
96 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
98 $mesg = $objectsrc->error;
99 $mesgs = $objectsrc->errors;
106 elseif ($action ==
'swapstatut' && $user->rights->expedition->creer)
108 $result = $objectsrc->swapContactStatus(
GETPOST(
'ligne'));
112 elseif ($action ==
'deletecontact' && $user->rights->expedition->creer)
114 $result = $objectsrc->delete_contact(
GETPOST(
"lineid"));
118 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
137 llxHeader(
'', $langs->trans(
'Order'),
'EN:Customers_Orders|FR:expeditions_Clients|ES:Pedidos de clientes');
139 $form =
new Form($db);
142 $contactstatic =
new Contact($db);
143 $userstatic =
new User($db);
152 if ($id > 0 || !empty($ref))
154 $langs->trans(
"OrderCard");
161 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
163 $morehtmlref =
'<div class="refidno">';
165 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'', $object->ref_customer, $object, $user->rights->expedition->creer,
'string',
'', 0, 1);
166 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'', $object->ref_customer, $object, $user->rights->expedition->creer,
'string',
'', null, null,
'', 1);
168 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
170 if (!empty($conf->projet->enabled)) {
171 $langs->load(
"projects");
172 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
174 if ($action !=
'classify') {
175 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
177 if ($action ==
'classify') {
179 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
180 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
181 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
182 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
183 $morehtmlref .=
'<input type="submit" class="button" value="'.$langs->trans(
"Modify").
'">';
184 $morehtmlref .=
'</form>';
186 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
191 $morehtmlref .=
' : ';
192 if (!empty($objectsrc->fk_project)) {
194 $proj->fetch($objectsrc->fk_project);
195 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$objectsrc->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
196 $morehtmlref .= $proj->ref;
197 $morehtmlref .=
'</a>';
203 $morehtmlref .=
'</div>';
206 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
209 print '<div class="fichecenter">';
211 print '<div class="underbanner clearboth"></div>';
213 print '<table class="border centpercent tableforfield">';
216 if ($typeobject ==
'commande' && $object->$typeobject->id && !empty($conf->commande->enabled))
218 print '<tr><td class="titlefield">';
220 $objectsrc->fetch($object->$typeobject->id);
221 print $langs->trans(
"RefOrder").
'</td>';
222 print '<td colspan="3">';
223 print $objectsrc->getNomUrl(1,
'commande');
227 if ($typeobject ==
'propal' && $object->$typeobject->id && !empty($conf->propal->enabled))
229 print '<tr><td class="titlefield">';
230 $objectsrc =
new Propal($db);
231 $objectsrc->fetch($object->$typeobject->id);
232 print $langs->trans(
"RefProposal").
'</td>';
233 print '<td colspan="3">';
234 print $objectsrc->getNomUrl(1,
'expedition');
252 print '<div class="clearboth"></div>';
261 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
262 $preselectedtypeofcontact =
dol_getIdFromCode($db,
'SHIPPING',
'c_type_contact',
'code',
'rowid');
263 foreach ($dirtpls as $reldir)
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
shipping_prepare_head($object)
Prepare array with list of tabs.
img_edit($titlealt= 'default', $float=0, $other= '')
Show logo editer/modifier fiche.
Class to manage Dolibarr users.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage projects.
Class to manage shipments.
Class to manage customers orders.
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_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0)
Return an id or code from a code or id.
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_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
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.
Class to manage proposals.