39 global $db, $langs, $conf, $user;
44 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.
$object->id;
45 $head[$h][1] = $langs->trans(
'SupplierInvoice');
46 $head[$h][2] =
'card';
50 $nbContact = count(
$object->liste_contact(-1,
'internal')) + count(
$object->liste_contact(-1,
'external'));
51 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/contact.php?facid='.
$object->id;
52 $head[$h][1] = $langs->trans(
'ContactsAddresses');
54 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
56 $head[$h][2] =
'contact';
61 if (isModEnabled(
'paymentbybanktransfer')) {
62 $nbStandingOrders = 0;
63 $sql =
"SELECT COUNT(pfd.rowid) as nb";
64 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
65 $sql .=
" WHERE pfd.fk_facture_fourn = ".((int)
$object->id);
66 $sql .=
" AND type = 'ban'";
67 $resql = $db->query($sql);
69 $obj = $db->fetch_object($resql);
71 $nbStandingOrders = $obj->nb;
76 $langs->load(
"banks");
77 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/prelevement.php?facid='.
$object->id.
'&type=bank-transfer';
78 $head[$h][1] = $langs->trans(
'BankTransfer');
79 if ($nbStandingOrders > 0) {
80 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbStandingOrders.
'</span>';
82 $head[$h][2] =
'standingorders';
94 if (!empty(
$object->note_private)) {
97 if (!empty(
$object->note_public)) {
100 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/note.php?facid='.
$object->id;
101 $head[$h][1] = $langs->trans(
'Notes');
103 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
105 $head[$h][2] =
'note';
109 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
110 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
111 $upload_dir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir(
$object->id, 2, 0, 0,
$object,
'invoice_supplier').$object->ref;
112 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
114 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/document.php?facid='.
$object->id;
115 $head[$h][1] = $langs->trans(
'Documents');
116 if (($nbFiles + $nbLinks) > 0) {
117 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
119 $head[$h][2] =
'documents';
122 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/info.php?facid='.
$object->id;
123 $head[$h][1] = $langs->trans(
'Info');
124 $head[$h][2] =
'info';
127 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/agenda.php?id='.
$object->id;
128 $head[$h][1] = $langs->trans(
"Events");
129 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
132 require_once DOL_DOCUMENT_ROOT.
'/core/lib/memory.lib.php';
133 $cachekey =
'count_events_facture_'.$object->id;
135 if (!is_null($dataretrieved)) {
136 $nbEvent = $dataretrieved;
138 $sql =
"SELECT COUNT(id) as nb";
139 $sql .=
" FROM ".MAIN_DB_PREFIX.
"actioncomm";
140 $sql .=
" WHERE fk_element = ".((int)
$object->id);
141 $sql .=
" AND elementtype = 'invoice_supplier'";
142 $resql = $db->query($sql);
144 $obj = $db->fetch_object($resql);
147 dol_syslog(
'Failed to count actioncomm '.$db->lasterror(), LOG_ERR);
153 $head[$h][1] .= $langs->trans(
"Agenda");
155 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbEvent.
'</span>';
158 $head[$h][2] =
'agenda';
177 global $db, $langs, $conf, $user;
182 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/card.php?id='.
$object->id;
183 $head[$h][1] = $langs->trans(
"SupplierOrder");
184 $head[$h][2] =
'card';
188 $nbContact = count(
$object->liste_contact(-1,
'internal')) + count(
$object->liste_contact(-1,
'external'));
189 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/contact.php?id='.
$object->id;
190 $head[$h][1] = $langs->trans(
'ContactsAddresses');
191 if ($nbContact > 0) {
192 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
194 $head[$h][2] =
'contact';
199 $langs->load(
"stocks");
200 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/dispatch.php?id='.
$object->id;
201 $head[$h][1] = $langs->trans(
"OrderDispatch");
204 if (in_array(
$object->statut, array($object::STATUS_ORDERSENT, $object::STATUS_RECEIVED_PARTIALLY, $object::STATUS_RECEIVED_COMPLETELY))) {
205 $sumQtyAllreadyDispatched = 0;
211 $nbLinesOrdered = count(
$object->lines);
212 $dispachedLines =
$object->getDispachedLines(1);
213 $nbDispachedLines = count($dispachedLines);
215 for ($line = 0 ; $line < $nbDispachedLines; $line++) {
216 $sumQtyAllreadyDispatched += $dispachedLines[$line][
'qty'];
218 for ($line = 0 ; $line < $nbLinesOrdered; $line++) {
221 $sumQtyOrdered +=
$object->lines[$line]->qty;
224 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.price2num($sumQtyAllreadyDispatched,
'MS').
' / '.
price2num($sumQtyOrdered,
'MS').
'</span>';
227 $head[$h][2] =
'dispatch';
239 if (!empty(
$object->note_private)) {
242 if (!empty(
$object->note_public)) {
245 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/note.php?id='.
$object->id;
246 $head[$h][1] = $langs->trans(
"Notes");
248 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
250 $head[$h][2] =
'note';
254 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
255 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
257 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
259 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/document.php?id='.
$object->id;
260 $head[$h][1] = $langs->trans(
'Documents');
261 if (($nbFiles + $nbLinks) > 0) {
262 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
264 $head[$h][2] =
'documents';
267 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/info.php?id='.
$object->id;
268 $head[$h][1] = $langs->trans(
"Events");
269 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
271 $head[$h][1] .= $langs->trans(
"Agenda");
273 $head[$h][2] =
'info';
290 global $langs, $conf, $user, $db;
293 $extrafields->fetch_name_optionals_label(
'commande_fournisseur');
294 $extrafields->fetch_name_optionals_label(
'commande_fournisseurdet');
295 $extrafields->fetch_name_optionals_label(
'facture_fourn');
296 $extrafields->fetch_name_optionals_label(
'facture_fourn_det');
297 $extrafields->fetch_name_optionals_label(
'facture_fourn_rec');
298 $extrafields->fetch_name_optionals_label(
'facture_fourn_det_rec');
303 $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_order.php";
304 $head[$h][1] = $langs->trans(
"SupplierOrder");
305 $head[$h][2] =
'order';
308 $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_invoice.php";
309 $head[$h][1] = $langs->trans(
"SuppliersInvoice");
310 $head[$h][2] =
'invoice';
313 $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_payment.php";
314 $head[$h][1] = $langs->trans(
"SuppliersPayment");
315 $head[$h][2] =
'supplierpayment';
320 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierorder_extrafields.php';
321 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrders");
322 $nbExtrafields = $extrafields->attributes[
'commande_fournisseur'][
'count'];
323 if ($nbExtrafields > 0) {
324 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
326 $head[$h][2] =
'supplierorder';
329 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierorderdet_extrafields.php';
330 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrdersLines");
331 $nbExtrafields = $extrafields->attributes[
'commande_fournisseurdet'][
'count'];
332 if ($nbExtrafields > 0) {
333 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
335 $head[$h][2] =
'supplierorderdet';
338 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoice_extrafields.php';
339 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoices");
340 $nbExtrafields = $extrafields->attributes[
'facture_fourn'][
'count'];
341 if ($nbExtrafields > 0) {
342 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
344 $head[$h][2] =
'supplierinvoice';
347 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoicedet_extrafields.php';
348 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesLines");
349 $nbExtrafields = $extrafields->attributes[
'facture_fourn_det'][
'count'];
350 if ($nbExtrafields > 0) {
351 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
353 $head[$h][2] =
'supplierinvoicedet';
356 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoice_rec_extrafields.php';
357 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesRec");
358 $nbExtrafields = $extrafields->attributes[
'facture_fourn_rec'][
'count'];
359 if ($nbExtrafields > 0) {
360 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
362 $head[$h][2] =
'attributesrec';
365 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoicedet_rec_extrafields.php';
366 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesLinesRec");
367 $nbExtrafields = $extrafields->attributes[
'facture_fourn_det_rec'][
'count'];
368 if ($nbExtrafields > 0) {
369 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
371 $head[$h][2] =
'attributeslinesrec';
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $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 '.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
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.
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)
Save data into a memory area shared by all users, all sessions on server.
dol_getcache($memoryid)
Read a memory area shared by all users, all sessions on server.