37 global $db, $langs, $conf;
42 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/card.php?facid='.$object->id;
43 $head[$h][1] = $langs->trans(
'SupplierInvoice');
44 $head[$h][2] =
'card';
47 if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
48 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
49 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/contact.php?facid='.$object->id;
50 $head[$h][1] = $langs->trans(
'ContactsAddresses');
52 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
54 $head[$h][2] =
'contact';
59 if (isModEnabled(
'paymentbybanktransfer')) {
60 $nbStandingOrders = 0;
61 $sql =
"SELECT COUNT(pfd.rowid) as nb";
62 $sql .=
" FROM ".MAIN_DB_PREFIX.
"prelevement_demande as pfd";
63 $sql .=
" WHERE pfd.fk_facture_fourn = ".((int) $object->id);
64 $sql .=
" AND type = 'ban'";
65 $resql = $db->query($sql);
67 $obj = $db->fetch_object($resql);
69 $nbStandingOrders = $obj->nb;
74 $langs->load(
"banks");
75 $head[$h][0] = DOL_URL_ROOT.
'/compta/facture/prelevement.php?facid='.$object->id.
'&type=bank-transfer';
76 $head[$h][1] = $langs->trans(
'BankTransfer');
77 if ($nbStandingOrders > 0) {
78 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbStandingOrders.
'</span>';
80 $head[$h][2] =
'standingorders';
90 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
92 if (!empty($object->note_private)) {
95 if (!empty($object->note_public)) {
98 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/note.php?facid='.$object->id;
99 $head[$h][1] = $langs->trans(
'Notes');
101 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
103 $head[$h][2] =
'note';
107 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
108 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
109 $upload_dir = $conf->fournisseur->facture->dir_output.
'/'.
get_exdir($object->id, 2, 0, 0, $object,
'invoice_supplier').$object->ref;
110 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
111 $nbLinks =
Link::count($db, $object->element, $object->id);
112 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/document.php?facid='.$object->id;
113 $head[$h][1] = $langs->trans(
'Documents');
114 if (($nbFiles + $nbLinks) > 0) {
115 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
117 $head[$h][2] =
'documents';
120 $head[$h][0] = DOL_URL_ROOT.
'/fourn/facture/info.php?facid='.$object->id;
121 $head[$h][1] = $langs->trans(
'Info');
122 $head[$h][2] =
'info';
141 global $db, $langs, $conf, $user;
146 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/card.php?id='.$object->id;
147 $head[$h][1] = $langs->trans(
"SupplierOrder");
148 $head[$h][2] =
'card';
151 if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) {
152 $nbContact = count($object->liste_contact(-1,
'internal')) + count($object->liste_contact(-1,
'external'));
153 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/contact.php?id='.$object->id;
154 $head[$h][1] = $langs->trans(
'ContactsAddresses');
155 if ($nbContact > 0) {
156 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbContact.
'</span>';
158 $head[$h][2] =
'contact';
162 if (isModEnabled(
'stock') && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) {
163 $langs->load(
"stocks");
164 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/dispatch.php?id='.$object->id;
165 $head[$h][1] = $langs->trans(
"OrderDispatch");
168 if (in_array($object->statut, array($object::STATUS_ORDERSENT, $object::STATUS_RECEIVED_PARTIALLY, $object::STATUS_RECEIVED_COMPLETELY))) {
169 $sumQtyAllreadyDispatched = 0;
172 if (empty($object->lines)) {
173 $object->fetch_lines();
175 $nbLinesOrdered = count($object->lines);
176 $dispachedLines = $object->getDispachedLines(1);
177 $nbDispachedLines = count($dispachedLines);
179 for ($line = 0 ; $line < $nbDispachedLines; $line++) {
180 $sumQtyAllreadyDispatched = $sumQtyAllreadyDispatched + $dispachedLines[$line][
'qty'];
182 for ($line = 0 ; $line < $nbLinesOrdered; $line++) {
184 if ($object->lines[$line]->product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) {
185 $sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty;
188 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.price2num($sumQtyAllreadyDispatched,
'MS').
' / '.
price2num($sumQtyOrdered,
'MS').
'</span>';
191 $head[$h][2] =
'dispatch';
201 if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) {
203 if (!empty($object->note_private)) {
206 if (!empty($object->note_public)) {
209 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/note.php?id='.$object->id;
210 $head[$h][1] = $langs->trans(
"Notes");
212 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbNote.
'</span>';
214 $head[$h][2] =
'note';
218 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
219 require_once DOL_DOCUMENT_ROOT.
'/core/class/link.class.php';
221 $nbFiles = count(
dol_dir_list($upload_dir,
'files', 0,
'',
'(\.meta|_preview.*\.png)$'));
222 $nbLinks =
Link::count($db, $object->element, $object->id);
223 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/document.php?id='.$object->id;
224 $head[$h][1] = $langs->trans(
'Documents');
225 if (($nbFiles + $nbLinks) > 0) {
226 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).
'</span>';
228 $head[$h][2] =
'documents';
231 $head[$h][0] = DOL_URL_ROOT.
'/fourn/commande/info.php?id='.$object->id;
232 $head[$h][1] = $langs->trans(
"Events");
233 if (isModEnabled(
'agenda') && ($user->hasRight(
'agenda',
'myactions',
'read') || $user->hasRight(
'agenda',
'allactions',
'read'))) {
235 $head[$h][1] .= $langs->trans(
"Agenda");
237 $head[$h][2] =
'info';
254 global $langs, $conf, $user, $db;
257 $extrafields->fetch_name_optionals_label(
'commande_fournisseur');
258 $extrafields->fetch_name_optionals_label(
'commande_fournisseurdet');
259 $extrafields->fetch_name_optionals_label(
'facture_fourn');
260 $extrafields->fetch_name_optionals_label(
'facture_fourn_det');
265 $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_order.php";
266 $head[$h][1] = $langs->trans(
"SupplierOrder");
267 $head[$h][2] =
'order';
270 $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_invoice.php";
271 $head[$h][1] = $langs->trans(
"SuppliersInvoice");
272 $head[$h][2] =
'invoice';
275 $head[$h][0] = DOL_URL_ROOT.
"/admin/supplier_payment.php";
276 $head[$h][1] = $langs->trans(
"SuppliersPayment");
277 $head[$h][2] =
'supplierpayment';
282 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierorder_extrafields.php';
283 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrders");
284 $nbExtrafields = $extrafields->attributes[
'commande_fournisseur'][
'count'];
285 if ($nbExtrafields > 0) {
286 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
288 $head[$h][2] =
'supplierorder';
291 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierorderdet_extrafields.php';
292 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierOrdersLines");
293 $nbExtrafields = $extrafields->attributes[
'commande_fournisseurdet'][
'count'];
294 if ($nbExtrafields > 0) {
295 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
297 $head[$h][2] =
'supplierorderdet';
300 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoice_extrafields.php';
301 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoices");
302 $nbExtrafields = $extrafields->attributes[
'facture_fourn'][
'count'];
303 if ($nbExtrafields > 0) {
304 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
306 $head[$h][2] =
'supplierinvoice';
309 $head[$h][0] = DOL_URL_ROOT.
'/admin/supplierinvoicedet_extrafields.php';
310 $head[$h][1] = $langs->trans(
"ExtraFieldsSupplierInvoicesLines");
311 $nbExtrafields = $extrafields->attributes[
'facture_fourn_det'][
'count'];
312 if ($nbExtrafields > 0) {
313 $head[$h][1] .=
'<span class="badge marginleftonlyshort">'.$nbExtrafields.
'</span>';
315 $head[$h][2] =
'supplierinvoicedet';
dol_dir_list($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.
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).
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.