27 require
'../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
29 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/reception.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
34 if (!empty($conf->project->enabled)) {
35 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
36 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
38 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
39 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.dispatch.class.php';
41 $langs->loadLangs(array(
"orders",
"receptions",
"companies"));
45 $action =
GETPOST(
'action',
'aZ09');
48 if ($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(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) ||
isModEnabled(
"supplier_order"))) {
62 $objectsrc->fetch($object->$typeobject->id);
67 if ($user->socid > 0) {
68 $socid = $user->socid;
70 if ($origin ==
'reception') {
73 if ($origin ==
'supplierorder' || $origin ==
'order_supplier') {
74 $result =
restrictedArea($user,
'fournisseur', $origin_id,
'commande_fournisseur',
'commande');
75 } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) {
81 $permissiontoread = $user->rights->reception->lire;
82 $permissiontoadd = $user->rights->reception->creer;
83 $permissiondellink = $user->rights->reception->creer;
84 $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)));
85 $permissiontodelete = $user->rights->reception->supprimer;
87 $permissiontoread = $user->rights->fournisseur->commande->receptionner;
88 $permissiontoadd = $user->rights->fournisseur->commande->receptionner;
89 $permissiondellink = $user->rights->fournisseur->commande->receptionner;
90 $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)));
91 $permissiontodelete = $user->rights->fournisseur->commande->receptionner;
99 if ($action ==
'addcontact' && $user->rights->reception->creer) {
100 if ($result > 0 && $id > 0) {
103 $result = $objectsrc->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
107 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
110 if ($objectsrc->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
111 $langs->load(
"errors");
112 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
114 $mesg = $objectsrc->error;
115 $mesgs = $objectsrc->errors;
119 } elseif ($action ==
'swapstatut' && $user->rights->reception->creer) {
121 $result = $objectsrc->swapContactStatus(
GETPOST(
'ligne',
'int'));
122 } elseif ($action ==
'deletecontact' && $user->rights->reception->creer) {
124 $result = $objectsrc->delete_contact(
GETPOST(
"lineid",
'int'));
127 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
139 llxHeader(
'', $langs->trans(
'Reception'),
'EN:Customers_Orders|FR:receptions_Clients|ES:Pedidos de clientes');
144 $contactstatic =
new Contact($db);
145 $userstatic =
new User($db);
150 if ($id > 0 || !empty($ref)) {
151 $langs->trans(
"OrderCard");
154 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"Reception"), -1,
'dollyrevert');
158 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
160 $morehtmlref =
'<div class="refidno">';
162 $morehtmlref .=
$form->editfieldkey(
"RefSupplier",
'', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'', 0, 1);
163 $morehtmlref .=
$form->editfieldval(
"RefSupplier",
'', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'',
null,
null,
'', 1);
165 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
167 if (!empty($conf->project->enabled)) {
168 $langs->load(
"projects");
169 $morehtmlref .=
'<br>';
171 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
172 if ($action !=
'classify' && $permissiontoadd) {
173 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
175 $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, ($action ==
'classify' ? 1 : 0), 0, 1,
'');
177 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
179 $proj->fetch($objectsrc->fk_project);
180 $morehtmlref .= $proj->getNomUrl(1);
182 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
187 $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">';
198 if ($origin ==
'order_supplier' && $object->$typeobject->id && (
isModEnabled(
"fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) ||
isModEnabled(
"supplier_order"))) {
199 print
'<tr><td class="titlefield">';
201 $objectsrc->fetch($object->$typeobject->id);
202 print $langs->trans(
"RefOrder").
'</td>';
203 print
'<td colspan="3">';
204 print $objectsrc->getNomUrl(1,
'commande');
208 if ($typeobject ==
'propal' && $object->$typeobject->id &&
isModEnabled(
"propal")) {
209 print
'<tr><td class="titlefield">';
210 $objectsrc =
new Propal($db);
211 $objectsrc->fetch($object->$typeobject->id);
212 print $langs->trans(
"RefProposal").
'</td>';
213 print
'<td colspan="3">';
214 print $objectsrc->getNomUrl(1,
'reception');
230 print
'<div class="clearboth"></div>';
239 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
240 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.
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
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='')
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
isModEnabled($module)
Is Dolibarr module enabled.
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.