';
- // Ref
- if (!empty($arrayfields['c.ref']['checked'])) {
- print '| ';
- print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
-
- $filename = dol_sanitizeFileName($obj->ref);
- $filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref);
- $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
- print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
-
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Ref customer
- if (!empty($arrayfields['c.ref_client']['checked'])) {
- print ''.$obj->ref_client.' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Project ref
- if (!empty($arrayfields['p.ref']['checked'])) {
- print '';
- if ($obj->project_id > 0) {
- print $projectstatic->getNomUrl(1);
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Project label
- if (!empty($arrayfields['p.title']['checked'])) {
- print '';
- if ($obj->project_id > 0) {
- print $projectstatic->title;
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Third party
- if (!empty($arrayfields['s.nom']['checked'])) {
- print '';
- print $getNomUrl_cache[$obj->socid];
-
- // If module invoices enabled and user with invoice creation permissions
- if (isModEnabled('facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) {
- if ($user->rights->facture->creer) {
- if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
- print ' ';
- print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').'';
+ // Action column
+ if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print ' | ';
+ if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ $selected = 0;
+ if (in_array($obj->rowid, $arrayofselected)) {
+ $selected = 1;
}
+ print '';
+ }
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ print ' | ';
+ }
+
+ // Ref
+ if (!empty($arrayfields['c.ref']['checked'])) {
+ print '';
+ print $generic_commande->getNomUrl(1, ($search_status != 2 ? 0 : $obj->fk_statut), 0, 0, 0, 1, 1);
+
+ $filename = dol_sanitizeFileName($obj->ref);
+ $filedir = $conf->commande->multidir_output[$conf->entity].'/'.dol_sanitizeFileName($obj->ref);
+ $urlsource = $_SERVER['PHP_SELF'].'?id='.$obj->rowid;
+ print $formfile->getDocumentsLink($generic_commande->element, $filename, $filedir);
+
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
}
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Alias name
- if (!empty($arrayfields['s.name_alias']['checked'])) {
- print '';
- print $obj->alias;
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Parent company
- if (!empty($arrayfields['s2.nom']['checked'])) {
- print '';
- if ($obj->fk_parent > 0) {
- if (!isset($company_url_list[$obj->fk_parent])) {
- $companyparent = new Societe($db);
- $res = $companyparent->fetch($obj->fk_parent);
- if ($res > 0) {
- $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
- }
- }
- if (isset($company_url_list[$obj->fk_parent])) {
- print $company_url_list[$obj->fk_parent];
+ // Ref customer
+ if (!empty($arrayfields['c.ref_client']['checked'])) {
+ print ' | '.$obj->ref_client.' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
}
- print "";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Town
- if (!empty($arrayfields['s.town']['checked'])) {
- print '';
- print $obj->town;
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Zip
- if (!empty($arrayfields['s.zip']['checked'])) {
- print '';
- print $obj->zip;
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // State
- if (!empty($arrayfields['state.nom']['checked'])) {
- print "".$obj->state_name." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Country
- if (!empty($arrayfields['country.code_iso']['checked'])) {
- print '';
- $tmparray = getCountry($obj->fk_pays, 'all');
- print $tmparray['label'];
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Type ent
- if (!empty($arrayfields['typent.code']['checked'])) {
- print '';
- if (empty($typenArray)) {
- $typenArray = $formcompany->typent_array(1);
- }
- print $typenArray[$obj->typent_code];
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Order date
- if (!empty($arrayfields['c.date_commande']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_commande), 'day');
- // Warning late icon and note
- if ($generic_commande->hasDelay()) {
- print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning");
- }
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Plannned date of delivery
- if (!empty($arrayfields['c.date_delivery']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_delivery), 'dayhour');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Shipping Method
- if (!empty($arrayfields['c.fk_shipping_method']['checked'])) {
- print '';
- $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Payment terms
- if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) {
- print '';
- $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Payment mode
- if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) {
- print '';
- $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Channel
- if (!empty($arrayfields['c.fk_input_reason']['checked'])) {
- print '';
- $form->formInputReason($_SERVER['PHP_SELF'], $obj->fk_input_reason, 'none', '');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Amount HT/net
- if (!empty($arrayfields['c.total_ht']['checked'])) {
- print ''.price($obj->total_ht)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ht';
- }
- if (isset($totalarray['val']['c.total_ht'])) {
- $totalarray['val']['c.total_ht'] += $obj->total_ht;
- } else {
- $totalarray['val']['c.total_ht'] = $obj->total_ht;
- }
- }
-
- // Amount VAT
- if (!empty($arrayfields['c.total_vat']['checked'])) {
- print ''.price($obj->total_tva)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'c.total_tva';
- }
- if (isset($totalarray['val']['c.total_tva'])) {
- $totalarray['val']['c.total_tva'] += $obj->total_tva;
- } else {
- $totalarray['val']['c.total_tva'] = $obj->total_tva;
- }
- }
-
- // Amount TTC / gross
- if (!empty($arrayfields['c.total_ttc']['checked'])) {
- print ''.price($obj->total_ttc)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ttc';
- }
- if (isset($totalarray['val']['c.total_ttc'])) {
- $totalarray['val']['c.total_ttc'] += $obj->total_ttc;
- } else {
- $totalarray['val']['c.total_ttc'] = $obj->total_ttc;
- }
- }
-
- // Currency
- if (!empty($arrayfields['c.multicurrency_code']['checked'])) {
- print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Currency rate
- if (!empty($arrayfields['c.multicurrency_tx']['checked'])) {
- print '';
- $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
- print " | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Amount HT/net in foreign currency
- if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) {
- print ''.price($obj->multicurrency_total_ht)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Amount VAT in foreign currency
- if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) {
- print ''.price($obj->multicurrency_total_vat)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Amount TTC / gross in foreign currency
- if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) {
- print ''.price($obj->multicurrency_total_ttc)." | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- $userstatic->id = $obj->fk_user_author;
- $userstatic->login = $obj->login;
- $userstatic->lastname = $obj->lastname;
- $userstatic->firstname = $obj->firstname;
- $userstatic->email = $obj->user_email;
- $userstatic->statut = $obj->user_statut;
- $userstatic->entity = $obj->entity;
- $userstatic->photo = $obj->photo;
- $userstatic->office_phone = $obj->office_phone;
- $userstatic->office_fax = $obj->office_fax;
- $userstatic->user_mobile = $obj->user_mobile;
- $userstatic->job = $obj->job;
- $userstatic->gender = $obj->gender;
-
- // Author
- if (!empty($arrayfields['u.login']['checked'])) {
- print '';
- if ($userstatic->id) {
- print $userstatic->getNomUrl(-1);
- } else {
- print ' ';
- }
- print " | \n";
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Sales representatives
- if (!empty($arrayfields['sale_representative']['checked'])) {
- print '';
- if ($obj->socid > 0) {
- $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
- if ($listsalesrepresentatives < 0) {
- dol_print_error($db);
+ // Project ref
+ if (!empty($arrayfields['p.ref']['checked'])) {
+ print ' | ';
+ if ($obj->project_id > 0) {
+ print $projectstatic->getNomUrl(1);
}
- $nbofsalesrepresentative = count($listsalesrepresentatives);
- if ($nbofsalesrepresentative > 6) {
- // We print only number
- print $nbofsalesrepresentative;
- } elseif ($nbofsalesrepresentative > 0) {
- $j = 0;
- foreach ($listsalesrepresentatives as $val) {
- $userstatic->id = $val['id'];
- $userstatic->lastname = $val['lastname'];
- $userstatic->firstname = $val['firstname'];
- $userstatic->email = $val['email'];
- $userstatic->statut = $val['statut'];
- $userstatic->entity = $val['entity'];
- $userstatic->photo = $val['photo'];
- $userstatic->login = $val['login'];
- $userstatic->office_phone = $val['office_phone'];
- $userstatic->office_fax = $val['office_fax'];
- $userstatic->user_mobile = $val['user_mobile'];
- $userstatic->job = $val['job'];
- $userstatic->gender = $val['gender'];
- //print ' ':
- print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
- $j++;
- if ($j < $nbofsalesrepresentative) {
- print ' ';
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Project label
+ if (!empty($arrayfields['p.title']['checked'])) {
+ print '';
+ if ($obj->project_id > 0) {
+ print $projectstatic->title;
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Third party
+ if (!empty($arrayfields['s.nom']['checked'])) {
+ print '';
+ print $getNomUrl_cache[$obj->socid];
+
+ // If module invoices enabled and user with invoice creation permissions
+ if (isModEnabled('facture') && !empty($conf->global->ORDER_BILLING_ALL_CUSTOMER)) {
+ if ($user->rights->facture->creer) {
+ if (($obj->fk_statut > 0 && $obj->fk_statut < 3) || ($obj->fk_statut == 3 && $obj->billed == 0)) {
+ print ' ';
+ print img_picto($langs->trans("CreateInvoiceForThisCustomer").' : '.$companystatic->name, 'object_bill', 'hideonsmartphone').'';
}
- //print '';
}
}
- //else print $langs->trans("NoSalesRepresentativeAffected");
- } else {
- print ' ';
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Total buying or cost price
- if (!empty($arrayfields['total_pa']['checked'])) {
- print ''.price($marginInfo['pa_total']).' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Alias name
+ if (!empty($arrayfields['s.name_alias']['checked'])) {
+ print '';
+ print $obj->alias;
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Total margin
- if (!empty($arrayfields['total_margin']['checked'])) {
- print ''.price($marginInfo['total_margin']).' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Parent company
+ if (!empty($arrayfields['s2.nom']['checked'])) {
+ print '';
+ if ($obj->fk_parent > 0) {
+ if (!isset($company_url_list[$obj->fk_parent])) {
+ $companyparent = new Societe($db);
+ $res = $companyparent->fetch($obj->fk_parent);
+ if ($res > 0) {
+ $company_url_list[$obj->fk_parent] = $companyparent->getNomUrl(1);
+ }
+ }
+ if (isset($company_url_list[$obj->fk_parent])) {
+ print $company_url_list[$obj->fk_parent];
+ }
+ }
+ print " | ";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'total_margin';
- }
- $totalarray['val']['total_margin'] += $marginInfo['total_margin'];
- }
- // Total margin rate
- if (!empty($arrayfields['total_margin_rate']['checked'])) {
- print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Town
+ if (!empty($arrayfields['s.town']['checked'])) {
+ print '';
+ print $obj->town;
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Total mark rate
- if (!empty($arrayfields['total_mark_rate']['checked'])) {
- print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Zip
+ if (!empty($arrayfields['s.zip']['checked'])) {
+ print '';
+ print $obj->zip;
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- if (!$i) {
- $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
+
+ // State
+ if (!empty($arrayfields['state.nom']['checked'])) {
+ print "".$obj->state_name." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- if ($i >= $imaxinloop - 1) {
- if (!empty($total_ht)) {
- $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
+
+ // Country
+ if (!empty($arrayfields['country.code_iso']['checked'])) {
+ print '';
+ $tmparray = getCountry($obj->fk_pays, 'all');
+ print $tmparray['label'];
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Type ent
+ if (!empty($arrayfields['typent.code']['checked'])) {
+ print '';
+ if (empty($typenArray)) {
+ $typenArray = $formcompany->typent_array(1);
+ }
+ print $typenArray[$obj->typent_code];
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Order date
+ if (!empty($arrayfields['c.date_commande']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_commande), 'day');
+ // Warning late icon and note
+ if ($generic_commande->hasDelay()) {
+ print img_picto($langs->trans("Late").' : '.$generic_commande->showDelay(), "warning");
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Plannned date of delivery
+ if (!empty($arrayfields['c.date_delivery']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_delivery), 'dayhour');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Shipping Method
+ if (!empty($arrayfields['c.fk_shipping_method']['checked'])) {
+ print '';
+ $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Payment terms
+ if (!empty($arrayfields['c.fk_cond_reglement']['checked'])) {
+ print '';
+ $form->form_conditions_reglement($_SERVER['PHP_SELF'], $obj->fk_cond_reglement, 'none', 0, '', 1, $obj->deposit_percent);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Payment mode
+ if (!empty($arrayfields['c.fk_mode_reglement']['checked'])) {
+ print '';
+ $form->form_modes_reglement($_SERVER['PHP_SELF'], $obj->fk_mode_reglement, 'none', '', -1);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Channel
+ if (!empty($arrayfields['c.fk_input_reason']['checked'])) {
+ print '';
+ $form->formInputReason($_SERVER['PHP_SELF'], $obj->fk_input_reason, 'none', '');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Amount HT/net
+ if (!empty($arrayfields['c.total_ht']['checked'])) {
+ print ''.price($obj->total_ht)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ht';
+ }
+ if (isset($totalarray['val']['c.total_ht'])) {
+ $totalarray['val']['c.total_ht'] += $obj->total_ht;
} else {
- $totalarray['val']['total_mark_rate'] = '';
+ $totalarray['val']['c.total_ht'] = $obj->total_ht;
}
}
- }
- // Extra fields
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
- // Fields from hook
- $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
- $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- print $hookmanager->resPrint;
-
- // Date creation
- if (!empty($arrayfields['c.datec']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Amount VAT
+ if (!empty($arrayfields['c.total_vat']['checked'])) {
+ print ''.price($obj->total_tva)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'c.total_tva';
+ }
+ if (isset($totalarray['val']['c.total_tva'])) {
+ $totalarray['val']['c.total_tva'] += $obj->total_tva;
+ } else {
+ $totalarray['val']['c.total_tva'] = $obj->total_tva;
+ }
}
- }
- // Date modification
- if (!empty($arrayfields['c.tms']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Amount TTC / gross
+ if (!empty($arrayfields['c.total_ttc']['checked'])) {
+ print ''.price($obj->total_ttc)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'c.total_ttc';
+ }
+ if (isset($totalarray['val']['c.total_ttc'])) {
+ $totalarray['val']['c.total_ttc'] += $obj->total_ttc;
+ } else {
+ $totalarray['val']['c.total_ttc'] = $obj->total_ttc;
+ }
}
- }
- // Date cloture
- if (!empty($arrayfields['c.date_cloture']['checked'])) {
- print '';
- print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser');
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Currency
+ if (!empty($arrayfields['c.multicurrency_code']['checked'])) {
+ print ''.$obj->multicurrency_code.' - '.$langs->trans('Currency'.$obj->multicurrency_code)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Note public
- if (!empty($arrayfields['c.note_public']['checked'])) {
- print '';
- print dol_string_nohtmltag($obj->note_public);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Currency rate
+ if (!empty($arrayfields['c.multicurrency_tx']['checked'])) {
+ print '';
+ $form->form_multicurrency_rate($_SERVER['PHP_SELF'].'?id='.$obj->rowid, $obj->multicurrency_tx, 'none', $obj->multicurrency_code);
+ print " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Note private
- if (!empty($arrayfields['c.note_private']['checked'])) {
- print '';
- print dol_string_nohtmltag($obj->note_private);
- print ' | ';
- if (!$i) {
- $totalarray['nbfield']++;
+ // Amount HT/net in foreign currency
+ if (!empty($arrayfields['c.multicurrency_total_ht']['checked'])) {
+ print ''.price($obj->multicurrency_total_ht)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Amount VAT in foreign currency
+ if (!empty($arrayfields['c.multicurrency_total_vat']['checked'])) {
+ print ''.price($obj->multicurrency_total_vat)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+ // Amount TTC / gross in foreign currency
+ if (!empty($arrayfields['c.multicurrency_total_ttc']['checked'])) {
+ print ''.price($obj->multicurrency_total_ttc)." | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
- }
- // Show shippable Icon (this creates subloops, so may be slow)
- if (!empty($arrayfields['shippable']['checked'])) {
- print '';
- if (!empty($show_shippable_command) && isModEnabled('stock')) {
- if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
- $generic_commande->getLinesArray(); // Load array ->lines
- $generic_commande->loadExpeditions(); // Load array ->expeditions
+ $userstatic->id = $obj->fk_user_author;
+ $userstatic->login = $obj->login;
+ $userstatic->lastname = $obj->lastname;
+ $userstatic->firstname = $obj->firstname;
+ $userstatic->email = $obj->user_email;
+ $userstatic->statut = $obj->user_statut;
+ $userstatic->entity = $obj->entity;
+ $userstatic->photo = $obj->photo;
+ $userstatic->office_phone = $obj->office_phone;
+ $userstatic->office_fax = $obj->office_fax;
+ $userstatic->user_mobile = $obj->user_mobile;
+ $userstatic->job = $obj->job;
+ $userstatic->gender = $obj->gender;
- $numlines = count($generic_commande->lines); // Loop on each line of order
- for ($lig = 0; $lig < $numlines; $lig++) {
- if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
- $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
- } else {
- $reliquat = $generic_commande->lines[$lig]->qty;
+ // Author
+ if (!empty($arrayfields['u.login']['checked'])) {
+ print ' | ';
+ if ($userstatic->id) {
+ print $userstatic->getNomUrl(-1);
+ } else {
+ print ' ';
+ }
+ print " | \n";
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Sales representatives
+ if (!empty($arrayfields['sale_representative']['checked'])) {
+ print '';
+ if ($obj->socid > 0) {
+ $listsalesrepresentatives = $companystatic->getSalesRepresentatives($user);
+ if ($listsalesrepresentatives < 0) {
+ dol_print_error($db);
+ }
+ $nbofsalesrepresentative = count($listsalesrepresentatives);
+ if ($nbofsalesrepresentative > 6) {
+ // We print only number
+ print $nbofsalesrepresentative;
+ } elseif ($nbofsalesrepresentative > 0) {
+ $j = 0;
+ foreach ($listsalesrepresentatives as $val) {
+ $userstatic->id = $val['id'];
+ $userstatic->lastname = $val['lastname'];
+ $userstatic->firstname = $val['firstname'];
+ $userstatic->email = $val['email'];
+ $userstatic->statut = $val['statut'];
+ $userstatic->entity = $val['entity'];
+ $userstatic->photo = $val['photo'];
+ $userstatic->login = $val['login'];
+ $userstatic->office_phone = $val['office_phone'];
+ $userstatic->office_fax = $val['office_fax'];
+ $userstatic->user_mobile = $val['user_mobile'];
+ $userstatic->job = $val['job'];
+ $userstatic->gender = $val['gender'];
+ //print ' ':
+ print ($nbofsalesrepresentative < 2) ? $userstatic->getNomUrl(-1, '', 0, 0, 12) : $userstatic->getNomUrl(-2);
+ $j++;
+ if ($j < $nbofsalesrepresentative) {
+ print ' ';
+ }
+ //print ' ';
}
- if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service
- $nbprod++; // order contains real products
- $generic_product->id = $generic_commande->lines[$lig]->fk_product;
+ }
+ //else print $langs->trans("NoSalesRepresentativeAffected");
+ } else {
+ print ' ';
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
- // Get local and virtual stock and store it into cache
- if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
- $generic_product->load_stock('nobatch,warehouseopen'); // ->load_virtual_stock() is already included into load_stock()
- $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
- $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
+ // Total buying or cost price
+ if (!empty($arrayfields['total_pa']['checked'])) {
+ print ''.price($marginInfo['pa_total']).' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Total margin
+ if (!empty($arrayfields['total_margin']['checked'])) {
+ print ''.price($marginInfo['total_margin']).' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'total_margin';
+ }
+ $totalarray['val']['total_margin'] += $marginInfo['total_margin'];
+ }
+
+ // Total margin rate
+ if (!empty($arrayfields['total_margin_rate']['checked'])) {
+ print ''.(($marginInfo['total_margin_rate'] == '') ? '' : price($marginInfo['total_margin_rate'], null, null, null, null, 2).'%').' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Total mark rate
+ if (!empty($arrayfields['total_mark_rate']['checked'])) {
+ print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ if (!$i) {
+ $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate';
+ }
+ if ($i >= $imaxinloop - 1) {
+ if (!empty($total_ht)) {
+ $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT');
+ } else {
+ $totalarray['val']['total_mark_rate'] = '';
+ }
+ }
+ }
+
+ // Extra fields
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
+ // Fields from hook
+ $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
+ $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ print $hookmanager->resPrint;
+
+ // Date creation
+ if (!empty($arrayfields['c.datec']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Date modification
+ if (!empty($arrayfields['c.tms']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Date cloture
+ if (!empty($arrayfields['c.date_cloture']['checked'])) {
+ print '';
+ print dol_print_date($db->jdate($obj->date_cloture), 'dayhour', 'tzuser');
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Note public
+ if (!empty($arrayfields['c.note_public']['checked'])) {
+ print '';
+ print dol_string_nohtmltag($obj->note_public);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Note private
+ if (!empty($arrayfields['c.note_private']['checked'])) {
+ print '';
+ print dol_string_nohtmltag($obj->note_private);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Show shippable Icon (this creates subloops, so may be slow)
+ if (!empty($arrayfields['shippable']['checked'])) {
+ print '';
+ if (!empty($show_shippable_command) && isModEnabled('stock')) {
+ if (($obj->fk_statut > $generic_commande::STATUS_DRAFT) && ($obj->fk_statut < $generic_commande::STATUS_CLOSED)) {
+ $generic_commande->getLinesArray(); // Load array ->lines
+ $generic_commande->loadExpeditions(); // Load array ->expeditions
+
+ $numlines = count($generic_commande->lines); // Loop on each line of order
+ for ($lig = 0; $lig < $numlines; $lig++) {
+ if (isset($generic_commande->expeditions[$generic_commande->lines[$lig]->id])) {
+ $reliquat = $generic_commande->lines[$lig]->qty - $generic_commande->expeditions[$generic_commande->lines[$lig]->id];
} else {
- $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
- $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
+ $reliquat = $generic_commande->lines[$lig]->qty;
}
+ if ($generic_commande->lines[$lig]->product_type == 0 && $generic_commande->lines[$lig]->fk_product > 0) { // If line is a product and not a service
+ $nbprod++; // order contains real products
+ $generic_product->id = $generic_commande->lines[$lig]->fk_product;
- if ($reliquat > $generic_product->stock_reel) {
- $notshippable++;
- }
- if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { // Default code. Default should be this case.
- $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20);
- $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel.'';
- $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique.'';
- $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : '');
- $text_info .= ' ';
- } else { // BUGGED CODE.
- // DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE.
- // COUNT STOCK WHEN WE SHOULD ALREADY HAVE VALUE
- // Detailed virtual stock, looks bugged, uncomplete and need heavy load.
- // stock order and stock order_supplier
- $stock_order = 0;
- $stock_order_supplier = 0;
- if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { // What about other options ?
- if (isModEnabled('commande')) {
- if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) {
- $generic_product->load_stats_commande(0, '1,2');
- $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty'];
- } else {
- $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'];
+ // Get local and virtual stock and store it into cache
+ if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product])) {
+ $generic_product->load_stock('nobatch,warehouseopen'); // ->load_virtual_stock() is already included into load_stock()
+ $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_reel;
+ $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
+ } else {
+ $generic_product->stock_reel = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stock_reel'];
+ $generic_product->stock_theorique = $productstat_cachevirtual[$generic_commande->lines[$lig]->fk_product]['stock_reel'] = $generic_product->stock_theorique;
+ }
+
+ if ($reliquat > $generic_product->stock_reel) {
+ $notshippable++;
+ }
+ if (empty($conf->global->SHIPPABLE_ORDER_ICON_IN_LIST)) { // Default code. Default should be this case.
+ $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->product_ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20);
+ $text_info .= ' - '.$langs->trans("Stock").': '.$generic_product->stock_reel.'';
+ $text_info .= ' - '.$langs->trans("VirtualStock").': '.$generic_product->stock_theorique.'';
+ $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : '');
+ $text_info .= ' ';
+ } else { // BUGGED CODE.
+ // DOES NOT TAKE INTO ACCOUNT MANUFACTURING. THIS CODE SHOULD BE USELESS. PREVIOUS CODE SEEMS COMPLETE.
+ // COUNT STOCK WHEN WE SHOULD ALREADY HAVE VALUE
+ // Detailed virtual stock, looks bugged, uncomplete and need heavy load.
+ // stock order and stock order_supplier
+ $stock_order = 0;
+ $stock_order_supplier = 0;
+ if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { // What about other options ?
+ if (isModEnabled('commande')) {
+ if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'])) {
+ $generic_product->load_stats_commande(0, '1,2');
+ $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'] = $generic_product->stats_commande['qty'];
+ } else {
+ $generic_product->stats_commande['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_customer'];
+ }
+ $stock_order = $generic_product->stats_commande['qty'];
}
- $stock_order = $generic_product->stats_commande['qty'];
+ if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) {
+ if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) {
+ $generic_product->load_stats_commande_fournisseur(0, '3');
+ $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty'];
+ } else {
+ $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'];
+ }
+ $stock_order_supplier = $generic_product->stats_commande_fournisseur['qty'];
+ }
+ }
+ $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20);
+ $text_stock_reel = $generic_product->stock_reel.'/'.$stock_order;
+ if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
+ $warning++;
+ $text_warning .= ''.$langs->trans('Available').' : '.$text_stock_reel.'';
+ }
+ if ($reliquat > $generic_product->stock_reel) {
+ $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.'';
+ } else {
+ $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.'';
}
if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) {
- if (empty($productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'])) {
- $generic_product->load_stats_commande_fournisseur(0, '3');
- $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'] = $generic_product->stats_commande_fournisseur['qty'];
- } else {
- $generic_product->stats_commande_fournisseur['qty'] = $productstat_cache[$generic_commande->lines[$lig]->fk_product]['stats_order_supplier'];
- }
- $stock_order_supplier = $generic_product->stats_commande_fournisseur['qty'];
+ $text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier;
}
+ $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : '');
+ $text_info .= ' ';
}
- $text_info .= $reliquat.' x '.$generic_commande->lines[$lig]->ref.' '.dol_trunc($generic_commande->lines[$lig]->product_label, 20);
- $text_stock_reel = $generic_product->stock_reel.'/'.$stock_order;
- if ($stock_order > $generic_product->stock_reel && !($generic_product->stock_reel < $generic_commande->lines[$lig]->qty)) {
- $warning++;
- $text_warning .= ''.$langs->trans('Available').' : '.$text_stock_reel.'';
- }
- if ($reliquat > $generic_product->stock_reel) {
- $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.'';
- } else {
- $text_info .= ''.$langs->trans('Available').' : '.$text_stock_reel.'';
- }
- if ((isModEnabled("fournisseur") && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || isModEnabled("supplier_order")) {
- $text_info .= ' '.$langs->trans('SupplierOrder').' : '.$stock_order_supplier;
- }
- $text_info .= ($reliquat != $generic_commande->lines[$lig]->qty ? ' ('.$langs->trans("QtyInOtherShipments").' '.($generic_commande->lines[$lig]->qty - $reliquat).')' : '');
- $text_info .= ' ';
}
}
+ if ($notshippable == 0) {
+ $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
+ $text_info = $text_icon.' '.$langs->trans('Shippable').' '.$text_info;
+ } else {
+ $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft');
+ $text_info = $text_icon.' '.$langs->trans('NonShippable').' '.$text_info;
+ }
}
- if ($notshippable == 0) {
- $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'green paddingleft');
- $text_info = $text_icon.' '.$langs->trans('Shippable').' '.$text_info;
- } else {
- $text_icon = img_picto('', 'dolly', '', false, 0, 0, '', 'error paddingleft');
- $text_info = $text_icon.' '.$langs->trans('NonShippable').' '.$text_info;
+
+ if ($nbprod) {
+ print $form->textwithtooltip('', $text_info, 2, 1, $text_icon, '', 2);
+ }
+ if ($warning) { // Always false in default mode
+ print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders').' '.$text_warning, 2, 1, img_picto('', 'error'), '', 2);
}
}
-
- if ($nbprod) {
- print $form->textwithtooltip('', $text_info, 2, 1, $text_icon, '', 2);
- }
- if ($warning) { // Always false in default mode
- print $form->textwithtooltip('', $langs->trans('NotEnoughForAllOrders').' '.$text_warning, 2, 1, img_picto('', 'error'), '', 2);
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
}
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
- // Billed
- if (!empty($arrayfields['c.facture']['checked'])) {
- print ''.yn($obj->billed).' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Import key
- if (!empty($arrayfields['c.import_key']['checked'])) {
- print ''.$obj->import_key.' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Status
- if (!empty($arrayfields['c.fk_statut']['checked'])) {
- print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).' | ';
- if (!$i) {
- $totalarray['nbfield']++;
- }
- }
-
- // Action column
- if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
- print '';
- if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
- $selected = 0;
- if (in_array($obj->rowid, $arrayofselected)) {
- $selected = 1;
+ // Billed
+ if (!empty($arrayfields['c.facture']['checked'])) {
+ print ' | '.yn($obj->billed).' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
}
- print '';
}
- print '';
- if (!$i) {
- $totalarray['nbfield']++;
+
+ // Import key
+ if (!empty($arrayfields['c.import_key']['checked'])) {
+ print ''.$obj->import_key.' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
}
+
+ // Status
+ if (!empty($arrayfields['c.fk_statut']['checked'])) {
+ print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ // Action column
+ if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+ print '';
+ if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+ $selected = 0;
+ if (in_array($obj->rowid, $arrayofselected)) {
+ $selected = 1;
+ }
+ print '';
+ }
+ print ' | ';
+ if (!$i) {
+ $totalarray['nbfield']++;
+ }
+ }
+
+ print "
\n";
+
+ $total += $obj->total_ht;
+ $subtotal += $obj->total_ht;
}
-
- print "\n";
-
- $total += $obj->total_ht;
- $subtotal += $obj->total_ht;
$i++;
}
diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php
index 966d7963d7c..08753b54ba4 100644
--- a/htdocs/core/class/commonorder.class.php
+++ b/htdocs/core/class/commonorder.class.php
@@ -32,6 +32,41 @@ abstract class CommonOrder extends CommonObject
{
use CommonIncoterm;
+
+ /**
+ * Return clicable link of object (with eventually picto)
+ *
+ * @param string $option Where point the link (0=> main card, 1,2 => shipment, 'nolink'=>No link)
+ * @return string HTML Code for Kanban thumb.
+ */
+ public function getKanbanView($option = '')
+ {
+ global $langs, $conf;
+
+ $return = '