27 require
'../../main.inc.php';
28 require_once DOL_DOCUMENT_ROOT.
'/core/lib/fourn.lib.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/company.lib.php';
32 if (!empty($conf->projet->enabled)) {
33 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
37 $langs->loadLangs(array(
"suppliers",
"orders",
"companies",
"stocks"));
41 $action =
GETPOST(
'action',
'aZ09');
43 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
44 $sortfield =
GETPOST(
"sortfield",
'alpha');
45 $sortorder =
GETPOST(
"sortorder",
'alpha');
47 if (empty($page) || $page == -1) { $page = 0; }
48 $offset = $limit * $page;
49 $pageprev = $page - 1;
50 $pagenext = $page + 1;
51 if (!$sortfield) $sortfield =
'a.datep,a.id';
52 if (!$sortorder) $sortorder =
'DESC,DESC';
54 if (
GETPOST(
'actioncode',
'array'))
56 $actioncode =
GETPOST(
'actioncode',
'array', 3);
57 if (!count($actioncode)) $actioncode =
'0';
59 $actioncode =
GETPOST(
"actioncode",
"alpha", 3) ?
GETPOST(
"actioncode",
"alpha", 3) : (
GETPOST(
"actioncode") ==
'0' ?
'0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECTS) ?
'' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECTS));
61 $search_agenda_label =
GETPOST(
'search_agenda_label');
65 if ($user->socid) $socid = $user->socid;
66 $result =
restrictedArea($user,
'fournisseur', $id,
'commande_fournisseur',
'commande');
77 $parameters = array(
'id'=>$id);
78 $reshook = $hookmanager->executeHooks(
'doActions', $parameters, $object, $action);
79 if ($reshook < 0)
setEventMessages($hookmanager->error, $hookmanager->errors,
'errors');
82 if (
GETPOST(
'button_removefilter_x',
'alpha') ||
GETPOST(
'button_removefilter.x',
'alpha') ||
GETPOST(
'button_removefilter',
'alpha'))
85 $search_agenda_label =
'';
94 $form =
new Form($db);
97 if ($id > 0 || !empty($ref))
99 $object->fetch($id, $ref);
100 $object->fetch_thirdparty();
101 $object->info($object->id);
104 $title = $langs->trans(
"SupplierOrder").
' - '.$object->ref.
' '.$object->name;
105 if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match(
'/projectnameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->ref.
' '.$object->name.
' - '.$langs->trans(
"Info");
106 $help_url =
'EN:Module_Suppliers_Orders|FR:CommandeFournisseur|ES:Módulo_Pedidos_a_proveedores';
119 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fourn/commande/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
121 $morehtmlref =
'<div class="refidno">';
123 $morehtmlref .= $form->editfieldkey(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', 0, 1);
124 $morehtmlref .= $form->editfieldval(
"RefSupplier",
'ref_supplier', $object->ref_supplier, $object, 0,
'string',
'', null, null,
'', 1);
126 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
128 if (!empty($conf->projet->enabled))
130 $langs->load(
"projects");
131 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
132 if ($user->rights->fournisseur->commande->creer)
134 if ($action !=
'classify') {
136 $morehtmlref .=
' : ';
138 if ($action ==
'classify') {
140 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
141 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
142 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
143 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
144 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
145 $morehtmlref .=
'</form>';
147 $morehtmlref .= $form->form_project(
$_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
150 if (!empty($object->fk_project)) {
152 $proj->fetch($object->fk_project);
153 $morehtmlref .=
'<a href="'.DOL_URL_ROOT.
'/projet/card.php?id='.$object->fk_project.
'" title="'.$langs->trans(
'ShowProject').
'">';
154 $morehtmlref .= $proj->ref;
155 $morehtmlref .=
'</a>';
161 $morehtmlref .=
'</div>';
163 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
166 print '<div class="fichecenter">';
167 print '<div class="underbanner clearboth"></div>';
173 print '<div class="clearboth"></div>';
183 $permok = $user->rights->agenda->myactions->create;
186 $out .=
'&originid='.$object->id.
'&origin=order_supplier';
190 print '<div class="tabsAction">';
192 if (!empty($conf->agenda->enabled))
194 if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create))
196 print '<a class="butAction" href="'.DOL_URL_ROOT.
'/comm/action/card.php?action=create'.$out.
'&backtopage='.urlencode(
$_SERVER[
"PHP_SELF"].
'?id='.$object->id).
'">'.$langs->trans(
"AddAction").
'</a>';
198 print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans(
"AddAction").
'</a>';
205 if (!empty($object->id))
207 $param =
'&id='.$object->id;
208 if (!empty($contextpage) && $contextpage !=
$_SERVER[
"PHP_SELF"]) $param .=
'&contextpage='.$contextpage;
209 if ($limit > 0 && $limit != $conf->liste_limit) $param .=
'&limit='.$limit;
226 $filters[
'search_agenda_label'] = $search_agenda_label;
227 show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode,
'', $filters, $sortfield, $sortorder);
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.
dol_now($mode= 'auto')
Return date for now.
dol_print_object_info($object, $usetable=0)
Show informations on an object TODO Move this into html.formother.
show_actions_done($conf, $langs, $db, $filterobj, $objcon= '', $noprint=0, $actioncode= '', $donetodo= 'done', $filters=array(), $sortfield= 'a.datep, a.id', $sortorder= 'DESC', $module= '')
Show html area with actions (done or not, ignore the name of function).
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage projects.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
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.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
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_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.