45 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.
$object->id;
46 $head[$h][1] = $langs->trans(
'SupplierInvoice');
47 $head[$h][2] =
'card';
51 $nbContact = count(
$object->liste_contact(-1,
'internal')) + count(
$object->liste_contact(-1,
'external'));
52 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/contact.php?facid='.
$object->id;
53 $head[$h][1] = $langs->trans(
'ContactsAddresses');
55 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
57 $head[$h][2] =
'contact';
63 $nbStandingOrders = 0;
64 $sql =
"SELECT COUNT(pfd.rowid) as nb";
65 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
66 $sql .=
" WHERE pfd.fk_facture_fourn = ".((int)
$object->id);
67 $sql .=
" AND type = 'ban'";
68 $resql =
$db->query($sql);
70 $obj =
$db->fetch_object($resql);
72 $nbStandingOrders = $obj->nb;
77 $langs->load(
"banks");
78 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/prelevement.php?facid='.
$object->id.
'&type=bank-transfer';
79 $head[$h][1] = $langs->trans(
'BankTransfer');
80 if ($nbStandingOrders > 0) {
81 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbStandingOrders.
'</span>';
83 $head[$h][2] =
'standingorders';
95 if (!empty(
$object->note_private)) {
98 if (!empty(
$object->note_public)) {
101 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/note.php?facid='.
$object->id;
102 $head[$h][1] = $langs->trans(
'Notes');
104 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
106 $head[$h][2] =
'note';
110 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
111 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
113 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
115 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/document.php?facid='.
$object->id;
116 $head[$h][1] = $langs->trans(
'Documents');
117 if (($nbFiles + $nbLinks) > 0) {
118 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
120 $head[$h][2] =
'documents';
123 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/info.php?facid='.
$object->id;
124 $head[$h][1] = $langs->trans(
'Info');
125 $head[$h][2] =
'info';
128 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/agenda.php?id='.
$object->id;
129 $head[$h][1] = $langs->trans(
"Events");
130 if (
isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
133 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
134 $cachekey =
'count_events_facture_'.$object->id;
136 if (!is_null($dataretrieved)) {
137 $nbEvent = $dataretrieved;
139 $sql =
"SELECT COUNT(id) as nb";
140 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
141 $sql .=
" WHERE fk_element = ".((int)
$object->id);
142 $sql .=
" AND elementtype = 'invoice_supplier'";
143 $resql =
$db->query($sql);
145 $obj =
$db->fetch_object($resql);
148 dol_syslog(
'Failed to count actioncomm '.
$db->lasterror(), LOG_ERR);
154 $head[$h][1] .= $langs->trans(
"Agenda");
156 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
159 $head[$h][2] =
'agenda';
183 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/card.php?id='.
$object->id;
184 $head[$h][1] = $langs->trans(
"SupplierOrder");
185 $head[$h][2] =
'card';
189 $nbContact = count(
$object->liste_contact(-1,
'internal')) + count(
$object->liste_contact(-1,
'external'));
190 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/contact.php?id='.
$object->id;
191 $head[$h][1] = $langs->trans(
'ContactsAddresses');
192 if ($nbContact > 0) {
193 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
195 $head[$h][2] =
'contact';
200 $langs->load(
"stocks");
201 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/dispatch.php?id='.
$object->id;
202 $head[$h][1] = $langs->trans(
"OrderDispatch");
205 if (in_array(
$object->status, array($object::STATUS_ORDERSENT, $object::STATUS_RECEIVED_PARTIALLY, $object::STATUS_RECEIVED_COMPLETELY))) {
206 $sumQtyAllreadyDispatched = 0;
212 $nbLinesOrdered = count(
$object->lines);
213 $dispachedLines =
$object->getDispachedLines(1);
214 $nbDispachedLines = count($dispachedLines);
216 for ($line = 0 ; $line < $nbDispachedLines; $line++) {
217 $sumQtyAllreadyDispatched += $dispachedLines[$line][
'qty'];
219 for ($line = 0 ; $line < $nbLinesOrdered; $line++) {
222 $sumQtyOrdered +=
$object->lines[$line]->qty;
225 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.price2num($sumQtyAllreadyDispatched,
'MS').
' / '.
price2num($sumQtyOrdered,
'MS').
'</span>';
228 $head[$h][2] =
'dispatch';
240 if (!empty(
$object->note_private)) {
243 if (!empty(
$object->note_public)) {
246 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/note.php?id='.
$object->id;
247 $head[$h][1] = $langs->trans(
"Notes");
249 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
251 $head[$h][2] =
'note';
255 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
256 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
258 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
260 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/document.php?id='.
$object->id;
261 $head[$h][1] = $langs->trans(
'Documents');
262 if (($nbFiles + $nbLinks) > 0) {
263 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
265 $head[$h][2] =
'documents';
268 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/info.php?id='.
$object->id;
269 $head[$h][1] = $langs->trans(
"Events");
270 if (
isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
273 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
274 $cachekey =
'count_events_order_'.$object->id;
276 if (!is_null($dataretrieved)) {
277 $nbEvent = $dataretrieved;
279 $sql =
"SELECT COUNT(id) as nb";
280 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
281 $sql .=
" WHERE fk_element = ".((int)
$object->id);
282 $sql .=
" AND elementtype = 'order_supplier'";
283 $resql =
$db->query($sql);
285 $obj =
$db->fetch_object($resql);
288 dol_syslog(
'Failed to count actioncomm '.
$db->lasterror(), LOG_ERR);
294 $head[$h][1] .= $langs->trans(
"Agenda");
296 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
299 $head[$h][2] =
'info';
316 global $langs,
$conf, $user, $extrafields;
318 $extrafields->fetch_name_optionals_label(
'commande_fournisseur');
319 $extrafields->fetch_name_optionals_label(
'commande_fournisseurdet');
320 $extrafields->fetch_name_optionals_label(
'facture_fourn');
321 $extrafields->fetch_name_optionals_label(
'facture_fourn_det');
322 $extrafields->fetch_name_optionals_label(
'facture_fourn_rec');
323 $extrafields->fetch_name_optionals_label(
'facture_fourn_det_rec');
328 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/supplier_order/admin/supplier_order.php");
329 $head[$h][1] = $langs->trans(
"SupplierOrder");
330 $head[$h][2] =
'order';
333 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/supplier_invoice/admin/supplier_invoice.php");
334 $head[$h][1] = $langs->trans(
"SuppliersInvoice");
335 $head[$h][2] =
'invoice';
338 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/supplier_invoice/admin/supplier_payment.php");
339 $head[$h][1] = $langs->trans(
"SuppliersPayment");
340 $head[$h][2] =
'supplierpayment';
345 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/supplier_order/admin/supplierorder_extrafields.php');
346 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrders");
347 $nbExtrafields = $extrafields->attributes[
'commande_fournisseur'][
'count'];
348 if ($nbExtrafields > 0) {
349 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
351 $head[$h][2] =
'supplierorder';
354 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/supplier_order/admin/supplierorderdet_extrafields.php');
355 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrdersLines");
356 $nbExtrafields = $extrafields->attributes[
'commande_fournisseurdet'][
'count'];
357 if ($nbExtrafields > 0) {
358 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
360 $head[$h][2] =
'supplierorderdet';
363 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/supplier_invoice/admin/supplierinvoice_extrafields.php');
364 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoices");
365 $nbExtrafields = $extrafields->attributes[
'facture_fourn'][
'count'];
366 if ($nbExtrafields > 0) {
367 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
369 $head[$h][2] =
'supplierinvoice';
372 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/supplier_invoice/admin/supplierinvoicedet_extrafields.php');
373 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesLines");
374 $nbExtrafields = $extrafields->attributes[
'facture_fourn_det'][
'count'];
375 if ($nbExtrafields > 0) {
376 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
378 $head[$h][2] =
'supplierinvoicedet';
381 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/supplier_invoice/admin/supplierinvoice_rec_extrafields.php');
382 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesRec");
383 $nbExtrafields = $extrafields->attributes[
'facture_fourn_rec'][
'count'];
384 if ($nbExtrafields > 0) {
385 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
387 $head[$h][2] =
'attributesrec';
390 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
'/supplier_invoice/admin/supplierinvoicedet_rec_extrafields.php');
391 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesLinesRec");
392 $nbExtrafields = $extrafields->attributes[
'facture_fourn_det_rec'][
'count'];
393 if ($nbExtrafields > 0) {
394 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
396 $head[$h][2] =
'attributeslinesrec';
if(! $sortfield) if(! $sortorder) $object
Class to manage predefined suppliers products.
Class to manage suppliers invoices.
static count($dbs, $objecttype, $objectid)
Return nb of links.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
ordersupplier_prepare_head(CommandeFournisseur $object)
Prepare array with list of tabs.
supplierorder_admin_prepare_head()
Return array head with list of tabs to view object information.
facturefourn_prepare_head(FactureFournisseur $object)
Prepare array with list of tabs.
price2num($amount, $rounding='', $option=0)
Function that return a number with universal decimal format (decimal separator is '.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_setcache($memoryid, $data, $expire=0, $filecache=0, $replace=0)
Save data into a memory area shared by all users, all sessions on server.
dol_getcache($memoryid, $filecache=0)
Read a memory area shared by all users, all sessions on server.