27require
'../main.inc.php';
28require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
29require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/core/lib/reception.lib.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
34if (isModEnabled(
'project')) {
35 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
38require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.dispatch.class.php';
41$langs->loadLangs(array(
"orders",
"receptions",
"companies"));
45$action =
GETPOST(
'action',
'aZ09');
48if ($id > 0 || !empty($ref)) {
49 $object->fetch($id, $ref);
50 $object->fetch_thirdparty();
52 if (!empty($object->origin)) {
53 $origin = $object->origin;
55 $object->fetch_origin();
56 $typeobject = $object->origin;
60 if ($origin ==
'order_supplier' && $object->$typeobject->id && isModEnabled(
"supplier_order")) {
62 $objectsrc->fetch($object->$typeobject->id);
67if ($user->socid > 0) {
68 $socid = $user->socid;
72if ($origin ==
'reception') {
75 if ($origin ==
'supplierorder' || $origin ==
'order_supplier') {
76 $result =
restrictedArea($user,
'fournisseur', $object,
'commande_fournisseur',
'commande');
77 } elseif (!$user->hasRight($origin,
'lire') && !$user->hasRight($origin,
'read')) {
82if (isModEnabled(
"reception")) {
83 $permissiontoread = $user->rights->reception->lire;
84 $permissiontoadd = $user->rights->reception->creer;
85 $permissiondellink = $user->rights->reception->creer;
86 $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate)));
87 $permissiontodelete = $user->rights->reception->supprimer;
89 $permissiontoread = $user->rights->fournisseur->commande->receptionner;
90 $permissiontoadd = $user->rights->fournisseur->commande->receptionner;
91 $permissiondellink = $user->rights->fournisseur->commande->receptionner;
92 $permissiontovalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande->receptionner)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->commande_advance->check)));
93 $permissiontodelete = $user->rights->fournisseur->commande->receptionner;
101if ($action ==
'addcontact' && $user->rights->reception->creer) {
102 if ($result > 0 && $id > 0) {
105 $result = $objectsrc->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
109 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
112 if ($objectsrc->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
113 $langs->load(
"errors");
114 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
116 $mesg = $objectsrc->error;
117 $mesgs = $objectsrc->errors;
121} elseif ($action ==
'swapstatut' && $user->rights->reception->creer) {
123 $result = $objectsrc->swapContactStatus(
GETPOST(
'ligne',
'int'));
124} elseif ($action ==
'deletecontact' && $user->rights->reception->creer) {
126 $result = $objectsrc->delete_contact(
GETPOST(
"lineid",
'int'));
129 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
141llxHeader(
'', $langs->trans(
'Reception'),
'EN:Customers_Orders|FR:receptions_Clients|ES:Pedidos de clientes');
143$form =
new Form($db);
146$contactstatic =
new Contact($db);
147$userstatic =
new User($db);
152if ($id > 0 || !empty($ref)) {
153 $langs->trans(
"OrderCard");
156 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"Reception"), -1,
'dollyrevert');
160 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
162 $morehtmlref =
'<div class="refidno">';
164 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'', 0, 1);
165 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'',
null,
null,
'', 1);
167 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
169 if (isModEnabled(
'project')) {
170 $langs->load(
"projects");
171 $morehtmlref .=
'<br>';
173 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
174 if ($action !=
'classify' && $permissiontoadd) {
175 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
177 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) ? $object->socid : -1), $object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
179 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
181 $proj->fetch($objectsrc->fk_project);
182 $morehtmlref .= $proj->getNomUrl(1);
184 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
189 $morehtmlref .=
'</div>';
191 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
194 print
'<div class="fichecenter">';
196 print
'<div class="underbanner clearboth"></div>';
198 print
'<table class="border centpercent tableforfield">';
200 if ($origin ==
'order_supplier' && $object->$typeobject->id && isModEnabled(
"supplier_order")) {
201 print
'<tr><td class="titlefield">';
203 $objectsrc->fetch($object->$typeobject->id);
204 print $langs->trans(
"RefOrder").
'</td>';
205 print
'<td colspan="3">';
206 print $objectsrc->getNomUrl(1,
'commande');
210 if ($typeobject ==
'propal' && $object->$typeobject->id && isModEnabled(
"propal")) {
211 print
'<tr><td class="titlefield">';
212 $objectsrc =
new Propal($db);
213 $objectsrc->fetch($object->$typeobject->id);
214 print $langs->trans(
"RefProposal").
'</td>';
215 print
'<td colspan="3">';
216 print $objectsrc->getNomUrl(1,
'reception');
232 print
'<div class="clearboth"></div>';
241 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
242 foreach ($dirtpls as $reldir) {
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader()
Empty header.
Class to manage predefined suppliers products.
Class to manage projects.
Class to manage proposals.
Class to manage receptions.
Class to manage Dolibarr users.
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.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
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...
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0)
Set event messages in dol_events session object.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
img_edit($titlealt='default', $float=0, $other='')
Show logo editer/modifier fiche.
reception_prepare_head(Reception $object)
Prepare array with list of tabs.
restrictedArea(User $user, $features, $object=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.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.