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->project->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 ($id > 0 || !empty($ref)) {
46 $object->fetch($id, $ref);
47 $object->fetch_thirdparty();
49 if (!empty($object->origin)) {
50 $typeobject = $object->origin;
51 $origin = $object->origin;
52 $object->fetch_origin();
56 if ($typeobject ==
'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) {
58 $objectsrc->fetch($object->$typeobject->id);
60 if ($typeobject ==
'propal' && $object->$typeobject->id && !empty($conf->propal->enabled)) {
61 $objectsrc =
new Propal($db);
62 $objectsrc->fetch($object->$typeobject->id);
68 $socid = $user->socid;
77 if ($action ==
'addcontact' && $user->rights->expedition->creer) {
78 if ($result > 0 && $id > 0) {
81 $result = $objectsrc->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
85 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
88 if ($objectsrc->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
89 $langs->load(
"errors");
90 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
92 $mesg = $objectsrc->error;
93 $mesgs = $objectsrc->errors;
97 } elseif ($action ==
'swapstatut' && $user->rights->expedition->creer) {
99 $result = $objectsrc->swapContactStatus(
GETPOST(
'ligne',
'int'));
100 } elseif ($action ==
'deletecontact' && $user->rights->expedition->creer) {
102 $result = $objectsrc->delete_contact(
GETPOST(
"lineid",
'int'));
105 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
118 $help_url =
'EN:Module_Shipments|FR:Module_Expéditions|ES:Módulo_Expediciones|DE:Modul_Lieferungen';
125 $contactstatic =
new Contact($db);
126 $userstatic =
new User($db);
135 if ($id > 0 || !empty($ref)) {
136 $langs->trans(
"OrderCard");
139 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"Shipment"), -1, $object->picto);
143 $linkback =
'<a href="'.DOL_URL_ROOT.
'/expedition/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
145 $morehtmlref =
'<div class="refidno">';
147 $morehtmlref .= $form->editfieldkey(
"RefCustomer",
'', $object->ref_customer, $object, $user->rights->expedition->creer,
'string',
'', 0, 1);
148 $morehtmlref .= $form->editfieldval(
"RefCustomer",
'', $object->ref_customer, $object, $user->rights->expedition->creer,
'string',
'', null, null,
'', 1);
150 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
152 if (!empty($conf->project->enabled)) {
153 $langs->load(
"projects");
154 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
156 if ($action !=
'classify') {
157 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
159 if ($action ==
'classify') {
161 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
162 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
163 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
164 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
165 $morehtmlref .=
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
166 $morehtmlref .=
'</form>';
168 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
173 $morehtmlref .=
' : ';
174 if (!empty($objectsrc->fk_project)) {
176 $proj->fetch($objectsrc->fk_project);
177 $morehtmlref .=
' : '.$proj->getNomUrl(1);
179 $morehtmlref .=
' - '.$proj->title;
186 $morehtmlref .=
'</div>';
189 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
192 print
'<div class="fichecenter">';
194 print
'<div class="underbanner clearboth"></div>';
196 print
'<table class="border centpercent tableforfield">';
199 if ($typeobject ==
'commande' && $object->$typeobject->id && !empty($conf->commande->enabled)) {
200 print
'<tr><td class="titlefield">';
202 $objectsrc->fetch($object->$typeobject->id);
203 print $langs->trans(
"RefOrder").
'</td>';
204 print
'<td colspan="3">';
205 print $objectsrc->getNomUrl(1,
'commande');
209 if ($typeobject ==
'propal' && $object->$typeobject->id && !empty($conf->propal->enabled)) {
210 print
'<tr><td class="titlefield">';
211 $objectsrc =
new Propal($db);
212 $objectsrc->fetch($object->$typeobject->id);
213 print $langs->trans(
"RefProposal").
'</td>';
214 print
'<td colspan="3">';
215 print $objectsrc->getNomUrl(1,
'expedition');
231 print
'<div class="clearboth"></div>';
240 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
241 $preselectedtypeofcontact =
dol_getIdFromCode($db,
'SHIPPING',
'c_type_contact',
'code',
'rowid');
242 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.
if($cancel &&!$id) if($action== 'add'&&!$cancel) if($action== 'delete') if($id) $form
Actions.
Class to manage Dolibarr users.
if(!defined('NOREQUIRESOC')) if(!defined('NOREQUIRETRAN')) if(!defined('NOCSRFCHECK')) if(!defined('NOTOKENRENEWAL')) if(!defined('NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined('NOREQUIREAJAX')) llxHeader()
Empty header.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_getIdFromCode($db, $key, $tablename, $fieldkey= 'code', $fieldid= 'id', $entityfilter=0, $filters= '')
Return an id or code from a code or id.
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.
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, $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_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
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.