29 require
'../main.inc.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/order.lib.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
32 require_once DOL_DOCUMENT_ROOT.
'/core/lib/images.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
34 require_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
35 if (!empty($conf->project->enabled)) {
36 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
40 $langs->loadLangs(array(
'companies',
'other',
'bills',
'orders'));
42 $action =
GETPOST(
'action',
'aZ09');
48 $limit =
GETPOST(
'limit',
'int') ?
GETPOST(
'limit',
'int') : $conf->liste_limit;
49 $sortfield =
GETPOST(
'sortfield',
'aZ09comma');
50 $sortorder =
GETPOST(
'sortorder',
'aZ09comma');
52 if (empty($page) || $page == -1) {
55 $offset = $limit * $page;
56 $pageprev = $page - 1;
57 $pagenext = $page + 1;
59 if (!empty($conf->global->MAIN_DOC_SORT_FIELD)) {
60 $sortfield = $conf->global->MAIN_DOC_SORT_FIELD;
62 if (!empty($conf->global->MAIN_DOC_SORT_ORDER)) {
63 $sortorder = $conf->global->MAIN_DOC_SORT_ORDER;
75 $permissiontoadd = $user->rights->commande->creer;
79 $socid = $user->socid;
88 if ($object->fetch($id)) {
89 $object->fetch_thirdparty();
90 $upload_dir = $conf->commande->multidir_output[$object->entity].
"/".
dol_sanitizeFileName($object->ref);
93 include DOL_DOCUMENT_ROOT.
'/core/actions_linkedfiles.inc.php';
99 $title = $langs->trans(
'Order').
" - ".$langs->trans(
'Documents');
100 $help_url =
'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge';
105 if ($id > 0 || !empty($ref)) {
106 if ($object->fetch($id, $ref)) {
107 $object->fetch_thirdparty();
109 $upload_dir = $conf->commande->multidir_output[$object->entity].
'/'.
dol_sanitizeFileName($object->ref);
112 print
dol_get_fiche_head($head,
'documents', $langs->trans(
'CustomerOrder'), -1,
'order');
115 $filearray =
dol_dir_list($upload_dir,
"files", 0,
'',
'(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) ==
'desc' ?SORT_DESC:SORT_ASC), 1);
117 foreach ($filearray as $key => $file) {
118 $totalsize += $file[
'size'];
123 $linkback =
'<a href="'.DOL_URL_ROOT.
'/commande/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
126 $morehtmlref =
'<div class="refidno">';
128 $morehtmlref .=
$form->editfieldkey(
"RefCustomer",
'ref_client', $object->ref_client, $object, 0,
'string',
'', 0, 1);
129 $morehtmlref .=
$form->editfieldval(
"RefCustomer",
'ref_client', $object->ref_client, $object, 0,
'string',
'',
null,
null,
'', 1);
131 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1);
133 if (!empty($conf->project->enabled)) {
134 $langs->load(
"projects");
135 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
136 if ($user->rights->commande->creer) {
137 if ($action !=
'classify') {
139 $morehtmlref .=
' : ';
141 if ($action ==
'classify') {
143 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
144 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
145 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
146 $morehtmlref .= $formproject->select_projects($object->thirdparty->id, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
147 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
148 $morehtmlref .=
'</form>';
150 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->thirdparty->id, $object->fk_project,
'none', 0, 0, 0, 1);
153 if (!empty($object->fk_project)) {
155 $proj->fetch($object->fk_project);
156 $morehtmlref .=
' : '.$proj->getNomUrl(1);
158 $morehtmlref .=
' - '.$proj->title;
165 $morehtmlref .=
'</div>';
169 $linkback =
'<a href="'.DOL_URL_ROOT.
'/commande/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
171 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref);
173 print
'<div class="fichecenter">';
174 print
'<div class="underbanner clearboth"></div>';
176 print
'<table class="border tableforfield centpercent">';
178 print
'<tr><td class="titlefield">'.$langs->trans(
"NbOfAttachedFiles").
'</td><td colspan="3">'.count($filearray).
'</td></tr>';
179 print
'<tr><td>'.$langs->trans(
"TotalSizeOfAttachedFiles").
'</td><td colspan="3">'.
dol_print_size($totalsize, 1, 1).
'</td></tr>';
187 $modulepart =
'commande';
188 $permissiontoadd = $user->rights->commande->creer;
189 $permtoedit = $user->rights->commande->creer;
190 $param =
'&id='.$object->id.
'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity);
191 include DOL_DOCUMENT_ROOT.
'/core/tpl/document_actions_post_headers.tpl.php';
196 header(
'Location: index.php');