26 require
'../main.inc.php';
27 require_once DOL_DOCUMENT_ROOT.
'/reception/class/reception.class.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/reception.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formother.class.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
33 if (!empty($conf->project->enabled)) {
34 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
35 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formprojet.class.php';
38 $langs->loadLangs(array(
"orders",
"receptions",
"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 $origin = $object->origin;
52 $object->fetch_origin();
53 $typeobject = $object->origin;
57 if ($origin ==
'order_supplier' && $object->$typeobject->id && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled))) {
59 $objectsrc->fetch($object->$typeobject->id);
64 if ($user->socid > 0) {
65 $socid = $user->socid;
67 if ($origin ==
'reception') {
70 if ($origin ==
'supplierorder' || $origin ==
'order_supplier') {
71 $result =
restrictedArea($user,
'fournisseur', $origin_id,
'commande_fournisseur',
'commande');
72 } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) {
82 if ($action ==
'addcontact' && $user->rights->reception->creer) {
83 if ($result > 0 && $id > 0) {
86 $result = $objectsrc->add_contact($contactid, $typeid,
GETPOST(
"source",
'aZ09'));
90 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
93 if ($objectsrc->error ==
'DB_ERROR_RECORD_ALREADY_EXISTS') {
94 $langs->load(
"errors");
95 $mesg = $langs->trans(
"ErrorThisContactIsAlreadyDefinedAsThisType");
97 $mesg = $objectsrc->error;
98 $mesgs = $objectsrc->errors;
102 } elseif ($action ==
'swapstatut' && $user->rights->reception->creer) {
104 $result = $objectsrc->swapContactStatus(
GETPOST(
'ligne',
'int'));
105 } elseif ($action ==
'deletecontact' && $user->rights->reception->creer) {
107 $result = $objectsrc->delete_contact(
GETPOST(
"lineid",
'int'));
110 header(
"Location: ".$_SERVER[
'PHP_SELF'].
"?id=".$object->id);
122 llxHeader(
'', $langs->trans(
'Reception'),
'EN:Customers_Orders|FR:receptions_Clients|ES:Pedidos de clientes');
127 $contactstatic =
new Contact($db);
128 $userstatic =
new User($db);
133 if ($id > 0 || !empty($ref)) {
134 $langs->trans(
"OrderCard");
137 print
dol_get_fiche_head($head,
'contact', $langs->trans(
"Reception"), -1,
'dollyrevert');
141 $linkback =
'<a href="'.DOL_URL_ROOT.
'/reception/list.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToList").
'</a>';
143 $morehtmlref =
'<div class="refidno">';
145 $morehtmlref .=
$form->editfieldkey(
"RefSupplier",
'', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'', 0, 1);
146 $morehtmlref .=
$form->editfieldval(
"RefSupplier",
'', $object->ref_supplier, $object, $user->rights->reception->creer,
'string',
'',
null,
null,
'', 1);
148 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
150 if (!empty($conf->project->enabled)) {
151 $langs->load(
"projects");
152 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
154 if ($action !=
'classify') {
155 $morehtmlref .=
'<a class="editfielda" href="'.$_SERVER[
'PHP_SELF'].
'?action=classify&token='.
newToken().
'&id='.$object->id.
'">'.
img_edit($langs->transnoentitiesnoconv(
'SetProject')).
'</a> : ';
157 if ($action ==
'classify') {
159 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
160 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
161 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
162 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
163 $morehtmlref .=
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'">';
164 $morehtmlref .=
'</form>';
166 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
171 $morehtmlref .=
' : ';
172 if (!empty($objectsrc->fk_project)) {
174 $proj->fetch($objectsrc->fk_project);
175 $morehtmlref .=
' : '.$proj->getNomUrl(1);
177 $morehtmlref .=
' - '.$proj->title;
184 $morehtmlref .=
'</div>';
186 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
189 print
'<div class="fichecenter">';
191 print
'<div class="underbanner clearboth"></div>';
193 print
'<table class="border centpercent">';
195 if ($origin ==
'order_supplier' && $object->$typeobject->id && (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) || !empty($conf->supplier_order->enabled))) {
196 print
'<tr><td class="titlefield">';
198 $objectsrc->fetch($object->$typeobject->id);
199 print $langs->trans(
"RefOrder").
'</td>';
200 print
'<td colspan="3">';
201 print $objectsrc->getNomUrl(1,
'commande');
205 if ($typeobject ==
'propal' && $object->$typeobject->id && !empty($conf->propal->enabled)) {
206 print
'<tr><td class="titlefield">';
207 $objectsrc =
new Propal($db);
208 $objectsrc->fetch($object->$typeobject->id);
209 print $langs->trans(
"RefProposal").
'</td>';
210 print
'<td colspan="3">';
211 print $objectsrc->getNomUrl(1,
'reception');
227 print
'<div class="clearboth"></div>';
236 $dirtpls = array_merge($conf->modules_parts[
'tpl'], array(
'/core/tpl'));
237 foreach ($dirtpls as $reldir) {