28require
'../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.php';
30require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
31require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
32require_once DOL_DOCUMENT_ROOT.
'/core/lib/reception.lib.php';
33require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
34require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
35if (isModEnabled(
'project')) {
36 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
37 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
39require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.dispatch.class.php';
42$langs->loadLangs(array(
"orders",
"receptions",
"companies"));
46$action =
GETPOST(
'action',
'aZ09');
49if ($id > 0 || !empty($ref)) {
61 if ($origin ==
'order_supplier' &&
$object->origin_object->id && isModEnabled(
"supplier_order")) {
63 $objectsrc->fetch(
$object->origin_object->id);
68if ($user->socid > 0) {
69 $socid = $user->socid;
73if ($origin ==
'reception') {
76 if ($origin ==
'supplierorder' || $origin ==
'order_supplier') {
77 $result =
restrictedArea($user,
'fournisseur', $object,
'commande_fournisseur',
'commande');
78 } elseif (!$user->hasRight($origin,
'lire') && !$user->hasRight($origin,
'read')) {
83if (isModEnabled(
"reception")) {
84 $permissiontoread = $user->hasRight(
'reception',
'lire');
85 $permissiontoadd = $user->hasRight(
'reception',
'creer');
86 $permissiondellink = $user->hasRight(
'reception',
'creer');
87 $permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'creer')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'reception',
'reception_advance',
'validate')));
88 $permissiontodelete = $user->hasRight(
'reception',
'supprimer');
90 $permissiontoread = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
91 $permissiontoadd = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
92 $permissiondellink = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
93 $permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'fournisseur',
'commande',
'receptionner')) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
'fournisseur',
'commande_advance',
'check')));
94 $permissiontodelete = $user->hasRight(
'fournisseur',
'commande',
'receptionner');
102if ($action ==
'addcontact' && $user->hasRight(
'reception',
'creer')) {
103 if ($result > 0 && $id > 0) {
106 $result = $objectsrc->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
110 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
113 if ($objectsrc->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
114 $langs->load(
"errors");
115 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
117 $mesg = $objectsrc->error;
118 $mesgs = $objectsrc->errors;
122} elseif ($action ==
'swapstatut' && $user->hasRight(
'reception',
'creer')) {
124 $result = $objectsrc->swapContactStatus(
GETPOSTINT(
'ligne'));
125} elseif ($action ==
'deletecontact' && $user->hasRight(
'reception',
'creer')) {
127 $result = $objectsrc->delete_contact(
GETPOSTINT(
"lineid"));
130 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".
$object->id);
142$help_url =
'EN:Customers_Orders|FR:receptions_Clients|ES:Pedidos de clientes';
143llxHeader(
'', $langs->trans(
'Reception'), $help_url,
'', 0, 0,
'',
'',
'',
'mod-reception page-card_contact');
145$form =
new Form($db);
148$contactstatic =
new Contact($db);
149$userstatic =
new User($db);
154if ($id > 0 || !empty($ref)) {
155 $langs->trans(
"OrderCard");
158 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"Reception"), -1,
'dollyrevert');
162 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
164 $morehtmlref =
'<div class="refidno">';
166 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'',
$object->ref_supplier, $object, $user->hasRight(
'reception',
'creer'),
'string',
'', 0, 1);
167 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'',
$object->ref_supplier, $object, $user->hasRight(
'reception',
'creer'),
'string',
'',
null,
null,
'', 1);
169 $morehtmlref .=
'<br>'.$object->thirdparty->getNomUrl(1);
171 if (isModEnabled(
'project')) {
172 $langs->load(
"projects");
173 $morehtmlref .=
'<br>';
175 $morehtmlref .=
img_picto($langs->trans(
"Project"),
'project',
'class="pictofixedwidth"');
176 if ($action !=
'classify' && $permissiontoadd) {
177 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.
$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> ';
179 $morehtmlref .= $form->form_project($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, (!
getDolGlobalString(
'PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS') ?
$object->socid : -1),
$object->fk_project, ($action ==
'classify' ?
'projectid' :
'none'), 0, 0, 0, 1,
'',
'maxwidth300');
181 if (!empty($objectsrc) && !empty($objectsrc->fk_project)) {
183 $proj->fetch($objectsrc->fk_project);
184 $morehtmlref .= $proj->getNomUrl(1);
186 $morehtmlref .=
'<span class="opacitymedium"> - '.dol_escape_htmltag($proj->title).
'</span>';
191 $morehtmlref .=
'</div>';
193 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
196 print
'<div class="fichecenter">';
198 print
'<div class="underbanner clearboth"></div>';
200 print
'<table class="border centpercent tableforfield">';
202 if ($origin ==
'order_supplier' &&
$object->origin_object->id && isModEnabled(
"supplier_order")) {
203 print
'<tr><td class="titlefield">';
205 $objectsrc->fetch(
$object->origin_object->id);
206 print $langs->trans(
"RefOrder").
'</td>';
207 print
'<td colspan="3">';
208 print $objectsrc->getNomUrl(1,
'commande');
212 if ($typeobject ==
'propal' &&
$object->origin_object->id && isModEnabled(
"propal")) {
213 print
'<tr><td class="titlefield">';
214 $objectsrc =
new Propal($db);
215 $objectsrc->fetch(
$object->origin_object->id);
216 print $langs->trans(
"RefProposal").
'</td>';
217 print
'<td colspan="3">';
218 print $objectsrc->getNomUrl(1,
'reception');
234 print
'<div class="clearboth"></div>';
243 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
244 foreach ($dirtpls as $reldir) {
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
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.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
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_get_fiche_end($notab=0)
Return tab footer of a card.
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.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify 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.