27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.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';
37 $langs->loadLangs(array(
"facture",
"orders",
"sendings",
"companies"));
41 $action =
GETPOST(
'action',
'aZ09');
44 if ($user->socid) $socid = $user->socid;
45 $result =
restrictedArea($user,
'fournisseur', $id,
'commande_fournisseur',
'commande');
54 if ($action ==
'addcontact' && $user->rights->fournisseur->commande->creer)
56 $result = $object->fetch($id);
58 if ($result > 0 && $id > 0)
62 $result = $object->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
67 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
70 if ($object->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS')
72 $langs->load(
"errors");
73 setEventMessages($langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType"), null,
'errors');
81 elseif ($action ==
'swapstatut' && $user->rights->fournisseur->commande->creer)
83 if ($object->fetch($id))
85 $result = $object->swapContactStatus(
GETPOST(
'ligne'));
92 elseif ($action ==
'deletecontact' && $user->rights->fournisseur->commande->creer)
95 $result = $object->delete_contact($_GET[
"lineid"]);
99 header(
"Location: ".
$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
111 $help_url =
'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
112 llxHeader(
'', $langs->trans(
"Order"), $help_url);
114 $form =
new Form($db);
116 $contactstatic =
new Contact($db);
117 $userstatic =
new User($db);
126 if ($id > 0 || !empty($ref))
128 $langs->trans(
"OrderCard");
130 if ($object->fetch($id, $ref) > 0)
132 $object->fetch_thirdparty();
139 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fourn/commande/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
141 $morehtmlref =
'<div class="refidno">';
143 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', 0, 1);
144 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', null, null,
'', 1);
146 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
148 if (!empty($conf->projet->enabled))
150 $langs->load(
"projects");
151 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
152 if ($user->rights->fournisseur->commande->creer)
154 if ($action !=
'classify') {
156 $morehtmlref .=
' : ';
158 if ($action ==
'classify') {
160 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
161 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
162 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
163 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
164 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
165 $morehtmlref .=
'</form>';
167 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
170 if (!empty($object->fk_project)) {
172 $proj->fetch($object->fk_project);
173 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
174 $morehtmlref .= $proj->ref;
175 $morehtmlref .=
'</a>';
181 $morehtmlref .=
'</div>';
184 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0,
'',
'', 1);
189 include DOL_DOCUMENT_ROOT.
'/core/tpl/contacts.tpl.php';
192 print "ErrorRecordNotFound";
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
ordersupplier_prepare_head($object)
Prepare array with list of tabs.
Class to manage Dolibarr users.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage projects.
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.
Class to manage predefined suppliers products.
print $_SERVER["PHP_SELF"]
Edit parameters.
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.