|
@@ -35,6 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php';
|
|
|
+require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php';
|
|
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
|
@@ -130,6 +131,9 @@ $fieldstosearchall = array(
|
|
|
'cf.ref_supplier'=>'RefSupplierOrder',
|
|
|
'pd.description'=>'Description',
|
|
|
's.nom'=>"ThirdParty",
|
|
|
+ 's.name_alias'=>"AliasNameShort",
|
|
|
+ 's.zip'=>"Zip",
|
|
|
+ 's.town'=>"Town",
|
|
|
'cf.note_public'=>'NotePublic',
|
|
|
);
|
|
|
if (empty($user->socid)) $fieldstosearchall["cf.note_private"] = "NotePrivate";
|
|
@@ -180,7 +184,7 @@ $arrayfields = dol_sort_array($arrayfields, 'position');
|
|
|
*/
|
|
|
|
|
|
if (GETPOST('cancel', 'alpha')) { $action = 'list'; $massaction = ''; }
|
|
|
-if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; }
|
|
|
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend' && $massaction != 'confirm_createsupplierbills') { $massaction = ''; }
|
|
|
|
|
|
$parameters = array('socid'=>$socid);
|
|
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
|
@@ -244,7 +248,7 @@ if (empty($reshook))
|
|
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
|
|
|
|
|
// TODO Move this into mass action include
|
|
|
- if ($massaction == 'confirm_createbills')
|
|
|
+ if ($massaction == 'confirm_createsupplierbills')
|
|
|
{
|
|
|
$orders = GETPOST('toselect', 'array');
|
|
|
$createbills_onebythird = GETPOST('createbills_onebythird', 'int');
|
|
@@ -258,34 +262,36 @@ if (empty($reshook))
|
|
|
$db->begin();
|
|
|
|
|
|
foreach ($orders as $id_order) {
|
|
|
- $cmd = new Commande($db);
|
|
|
+ $cmd = new CommandeFournisseur($db);
|
|
|
if ($cmd->fetch($id_order) <= 0) continue;
|
|
|
|
|
|
- $object = new Facture($db);
|
|
|
- if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $object = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
|
|
|
+ $objecttmp = new FactureFournisseur($db);
|
|
|
+ if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order.
|
|
|
else {
|
|
|
- $object->socid = $cmd->socid;
|
|
|
- $object->type = Facture::TYPE_STANDARD;
|
|
|
- $object->cond_reglement_id = $cmd->cond_reglement_id;
|
|
|
- $object->mode_reglement_id = $cmd->mode_reglement_id;
|
|
|
- $object->fk_project = $cmd->fk_project;
|
|
|
-
|
|
|
- $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
|
|
+ $objecttmp->socid = $cmd->socid;
|
|
|
+ $objecttmp->type = $objecttmp::TYPE_STANDARD;
|
|
|
+ $objecttmp->cond_reglement_id = $cmd->cond_reglement_id;
|
|
|
+ $objecttmp->mode_reglement_id = $cmd->mode_reglement_id;
|
|
|
+ $objecttmp->fk_project = $cmd->fk_project;
|
|
|
+ $objecttmp->multicurrency_code = $cmd->multicurrency_code;
|
|
|
+ if (empty($createbills_onebythird)) $objecttmp->ref_client = $cmd->ref_client;
|
|
|
+
|
|
|
+ $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
|
|
if (empty($datefacture))
|
|
|
{
|
|
|
- $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y"));
|
|
|
+ $datefacture = dol_now();
|
|
|
}
|
|
|
|
|
|
- $object->date = $datefacture;
|
|
|
- $object->origin = 'commande';
|
|
|
- $object->origin_id = $id_order;
|
|
|
+ $objecttmp->date = $datefacture;
|
|
|
+ $objecttmp->origin = 'order_supplier';
|
|
|
+ $objecttmp->origin_id = $id_order;
|
|
|
|
|
|
- $res = $object->create($user);
|
|
|
+ $res = $objecttmp->create($user);
|
|
|
|
|
|
if ($res > 0) $nb_bills_created++;
|
|
|
}
|
|
|
|
|
|
- if ($object->id > 0)
|
|
|
+ if ($objecttmp->id > 0)
|
|
|
{
|
|
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element (";
|
|
|
$sql .= "fk_source";
|
|
@@ -294,9 +300,9 @@ if (empty($reshook))
|
|
|
$sql .= ", targettype";
|
|
|
$sql .= ") VALUES (";
|
|
|
$sql .= $id_order;
|
|
|
- $sql .= ", '".$db->escape($object->origin)."'";
|
|
|
- $sql .= ", ".$object->id;
|
|
|
- $sql .= ", '".$db->escape($object->element)."'";
|
|
|
+ $sql .= ", '".$db->escape($objecttmp->origin)."'";
|
|
|
+ $sql .= ", ".$objecttmp->id;
|
|
|
+ $sql .= ", '".$db->escape($objecttmp->element)."'";
|
|
|
$sql .= ")";
|
|
|
|
|
|
if (!$db->query($sql))
|
|
@@ -323,7 +329,7 @@ if (empty($reshook))
|
|
|
{
|
|
|
// Negative line, we create a discount line
|
|
|
$discount = new DiscountAbsolute($db);
|
|
|
- $discount->fk_soc = $object->socid;
|
|
|
+ $discount->fk_soc = $objecttmp->socid;
|
|
|
$discount->amount_ht = abs($lines[$i]->total_ht);
|
|
|
$discount->amount_tva = abs($lines[$i]->total_tva);
|
|
|
$discount->amount_ttc = abs($lines[$i]->total_ttc);
|
|
@@ -333,7 +339,7 @@ if (empty($reshook))
|
|
|
$discountid = $discount->create($user);
|
|
|
if ($discountid > 0)
|
|
|
{
|
|
|
- $result = $object->insert_discount($discountid);
|
|
|
+ $result = $objecttmp->insert_discount($discountid);
|
|
|
//$result=$discount->link_to_invoice($lineid,$id);
|
|
|
} else {
|
|
|
setEventMessages($discount->error, $discount->errors, 'errors');
|
|
@@ -358,32 +364,31 @@ if (empty($reshook))
|
|
|
{
|
|
|
$fk_parent_line = 0;
|
|
|
}
|
|
|
- $result = $object->addline(
|
|
|
+ $result = $objecttmp->addline(
|
|
|
$desc,
|
|
|
$lines[$i]->subprice,
|
|
|
- $lines[$i]->qty,
|
|
|
$lines[$i]->tva_tx,
|
|
|
$lines[$i]->localtax1_tx,
|
|
|
$lines[$i]->localtax2_tx,
|
|
|
- $lines[$i]->fk_product,
|
|
|
+ $lines[$i]->qty,
|
|
|
+ $lines[$i]->fk_product,
|
|
|
$lines[$i]->remise_percent,
|
|
|
$date_start,
|
|
|
$date_end,
|
|
|
0,
|
|
|
$lines[$i]->info_bits,
|
|
|
- $lines[$i]->fk_remise_except,
|
|
|
- 'HT',
|
|
|
- 0,
|
|
|
- $product_type,
|
|
|
- $ii,
|
|
|
- $lines[$i]->special_code,
|
|
|
- $object->origin,
|
|
|
- $lines[$i]->rowid,
|
|
|
- $fk_parent_line,
|
|
|
- $lines[$i]->fk_fournprice,
|
|
|
- $lines[$i]->pa_ht,
|
|
|
- $lines[$i]->label
|
|
|
- );
|
|
|
+ 'HT',
|
|
|
+ $product_type,
|
|
|
+ $lines[$i]->rang,
|
|
|
+ false,
|
|
|
+ $lines[$i]->array_options,
|
|
|
+ $lines[$i]->fk_unit,
|
|
|
+ $objecttmp->origin_id,
|
|
|
+ $lines[$i]->pa_ht,
|
|
|
+ $lines[$i]->ref_supplier,
|
|
|
+ $lines[$i]->special_code,
|
|
|
+ $fk_parent_line
|
|
|
+ );
|
|
|
if ($result > 0)
|
|
|
{
|
|
|
$lineid = $result;
|
|
@@ -404,8 +409,8 @@ if (empty($reshook))
|
|
|
|
|
|
$cmd->classifyBilled($user); // TODO Move this in workflow like done for customer orders
|
|
|
|
|
|
- if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $object;
|
|
|
- else $TFact[$object->id] = $object;
|
|
|
+ if (!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $objecttmp;
|
|
|
+ else $TFact[$objecttmp->id] = $objecttmp;
|
|
|
}
|
|
|
|
|
|
// Build doc with all invoices
|
|
@@ -415,38 +420,67 @@ if (empty($reshook))
|
|
|
if (!$error && $validate_invoices) {
|
|
|
$massaction = $action = 'builddoc';
|
|
|
|
|
|
- foreach ($TAllFact as &$object)
|
|
|
+ foreach ($TAllFact as &$objecttmp)
|
|
|
{
|
|
|
- $object->validate($user);
|
|
|
+ $objecttmp->validate($user);
|
|
|
if ($result <= 0)
|
|
|
{
|
|
|
$error++;
|
|
|
- setEventMessages($object->error, $object->errors, 'errors');
|
|
|
+ setEventMessages($objecttmp->error, $objecttmp->errors, 'errors');
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- $id = $object->id; // For builddoc action
|
|
|
+ $id = $objecttmp->id; // For builddoc action
|
|
|
|
|
|
// Fac builddoc
|
|
|
$donotredirect = 1;
|
|
|
- $upload_dir = $conf->facture->dir_output;
|
|
|
- $permissiontoadd = $user->rights->facture->creer;
|
|
|
- include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
|
|
+ $upload_dir = $conf->fournisseur->facture->dir_output;
|
|
|
+ $permissiontoadd = $user->rights->fournisseur->facture->creer;
|
|
|
+ //include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
|
|
}
|
|
|
|
|
|
- $massaction = $action = 'confirm_createbills';
|
|
|
+ $massaction = $action = 'confirm_createsupplierbills';
|
|
|
}
|
|
|
|
|
|
if (!$error)
|
|
|
{
|
|
|
$db->commit();
|
|
|
setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs');
|
|
|
+
|
|
|
+ // Make a redirect to avoid to bill twice if we make a refresh or back
|
|
|
+ $param = '';
|
|
|
+ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
|
|
+ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
|
|
+ if ($sall) $param .= '&sall='.urlencode($sall);
|
|
|
+ if ($socid > 0) $param .= '&socid='.urlencode($socid);
|
|
|
+ if ($search_status != '') $param .= '&search_status='.urlencode($search_status);
|
|
|
+ if ($search_orderday) $param .= '&search_orderday='.urlencode($search_orderday);
|
|
|
+ if ($search_ordermonth) $param .= '&search_ordermonth='.urlencode($search_ordermonth);
|
|
|
+ if ($search_orderyear) $param .= '&search_orderyear='.urlencode($search_orderyear);
|
|
|
+ if ($search_deliveryday) $param .= '&search_deliveryday='.urlencode($search_deliveryday);
|
|
|
+ if ($search_deliverymonth) $param .= '&search_deliverymonth='.urlencode($search_deliverymonth);
|
|
|
+ if ($search_deliveryyear) $param .= '&search_deliveryyear='.urlencode($search_deliveryyear);
|
|
|
+ if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
|
|
+ if ($search_company) $param .= '&search_company='.urlencode($search_company);
|
|
|
+ if ($search_ref_customer) $param .= '&search_ref_customer='.urlencode($search_ref_customer);
|
|
|
+ if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
|
|
|
+ if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
|
|
|
+ if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht);
|
|
|
+ if ($search_total_vat != '') $param .= '&search_total_vat='.urlencode($search_total_vat);
|
|
|
+ if ($search_total_ttc != '') $param .= '&search_total_ttc='.urlencode($search_total_ttc);
|
|
|
+ if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref);
|
|
|
+ if ($show_files) $param .= '&show_files='.urlencode($show_files);
|
|
|
+ if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss);
|
|
|
+ if ($billed != '') $param .= '&billed='.urlencode($billed);
|
|
|
+
|
|
|
+ header("Location: ".$_SERVER['PHP_SELF'].'?'.$param);
|
|
|
+ exit;
|
|
|
} else {
|
|
|
$db->rollback();
|
|
|
$action = 'create';
|
|
|
$_GET["origin"] = $_POST["origin"];
|
|
|
$_GET["originid"] = $_POST["originid"];
|
|
|
- setEventMessages($object->error, $object->errors, 'errors');
|
|
|
+ setEventMessages("Error", null, 'errors');
|
|
|
$error++;
|
|
|
}
|
|
|
}
|
|
@@ -566,6 +600,7 @@ $sql .= $hookmanager->resPrint;
|
|
|
|
|
|
$sql .= $db->order($sortfield, $sortorder);
|
|
|
|
|
|
+// Count total nb of records
|
|
|
$nbtotalofrecords = '';
|
|
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
|
{
|
|
@@ -579,6 +614,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
|
|
}
|
|
|
|
|
|
$sql .= $db->plimit($limit + 1, $offset);
|
|
|
+//print $sql;
|
|
|
|
|
|
$resql = $db->query($sql);
|
|
|
if ($resql)
|
|
@@ -607,23 +643,24 @@ if ($resql)
|
|
|
llxHeader('', $title, $help_url);
|
|
|
|
|
|
$param = '';
|
|
|
- if ($socid > 0) $param .= '&socid='.$socid;
|
|
|
- if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage;
|
|
|
- if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit;
|
|
|
- if ($sall) $param .= "&search_all=".$sall;
|
|
|
- if ($search_orderday) $param .= '&search_orderday='.$search_orderday;
|
|
|
- if ($search_ordermonth) $param .= '&search_ordermonth='.$search_ordermonth;
|
|
|
- if ($search_orderyear) $param .= '&search_orderyear='.$search_orderyear;
|
|
|
- if ($search_deliveryday) $param .= '&search_deliveryday='.$search_deliveryday;
|
|
|
- if ($search_deliverymonth) $param .= '&search_deliverymonth='.$search_deliverymonth;
|
|
|
- if ($search_deliveryyear) $param .= '&search_deliveryyear='.$search_deliveryyear;
|
|
|
- if ($search_ref) $param .= '&search_ref='.$search_ref;
|
|
|
- if ($search_company) $param .= '&search_company='.$search_company;
|
|
|
- if ($search_user > 0) $param .= '&search_user='.$search_user;
|
|
|
- if ($search_request_author) $param .= '&search_request_author='.$search_request_author;
|
|
|
- if ($search_sale > 0) $param .= '&search_sale='.$search_sale;
|
|
|
- if ($search_total_ht != '') $param .= '&search_total_ht='.$search_total_ht;
|
|
|
- if ($search_total_ttc != '') $param .= "&search_total_ttc=".$search_total_ttc;
|
|
|
+ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage);
|
|
|
+ if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit);
|
|
|
+ if ($sall) $param .= '&sall='.urlencode($sall);
|
|
|
+ if ($socid > 0) $param .= '&socid='.urlencode($socid);
|
|
|
+ if ($sall) $param .= "&search_all=".urlencode($sall);
|
|
|
+ if ($search_orderday) $param .= '&search_orderday='.urlencode($search_orderday);
|
|
|
+ if ($search_ordermonth) $param .= '&search_ordermonth='.urlencode($search_ordermonth);
|
|
|
+ if ($search_orderyear) $param .= '&search_orderyear='.urlencode($search_orderyear);
|
|
|
+ if ($search_deliveryday) $param .= '&search_deliveryday='.urlencode($search_deliveryday);
|
|
|
+ if ($search_deliverymonth) $param .= '&search_deliverymonth='.urlencode($search_deliverymonth);
|
|
|
+ if ($search_deliveryyear) $param .= '&search_deliveryyear='.urlencode($search_deliveryyear);
|
|
|
+ if ($search_ref) $param .= '&search_ref='.urlencode($search_ref);
|
|
|
+ if ($search_company) $param .= '&search_company='.urlencode($search_company);
|
|
|
+ if ($search_user > 0) $param .= '&search_user='.urlencode($search_user);
|
|
|
+ if ($search_request_author) $param .= '&search_request_author='.urlencode($search_request_author);
|
|
|
+ if ($search_sale > 0) $param .= '&search_sale='.urlencode($search_sale);
|
|
|
+ if ($search_total_ht != '') $param .= '&search_total_ht='.urlencode($search_total_ht);
|
|
|
+ if ($search_total_ttc != '') $param .= "&search_total_ttc=".urlencode($search_total_ttc);
|
|
|
if ($search_multicurrency_code != '') $param .= '&search_multicurrency_code='.urlencode($search_multicurrency_code);
|
|
|
if ($search_multicurrency_tx != '') $param .= '&search_multicurrency_tx='.urlencode($search_multicurrency_tx);
|
|
|
if ($search_multicurrency_montant_ht != '') $param .= '&search_multicurrency_montant_ht='.urlencode($search_multicurrency_montant_ht);
|
|
@@ -644,7 +681,7 @@ if ($resql)
|
|
|
'builddoc'=>$langs->trans("PDFMerge"),
|
|
|
'presend'=>$langs->trans("SendByMail"),
|
|
|
);
|
|
|
- //if($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer");
|
|
|
+ if ($user->rights->fournisseur->facture->creer) $arrayofmassactions['createbills'] = $langs->trans("CreateInvoiceForThisSupplier");
|
|
|
if ($user->rights->fournisseur->commande->supprimer) $arrayofmassactions['predelete'] = '<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
|
|
if (in_array($massaction, array('presend', 'predelete', 'createbills'))) $arrayofmassactions = array();
|
|
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
|
@@ -653,15 +690,16 @@ if ($resql)
|
|
|
if (!empty($socid)) $url .= '&socid='.$socid;
|
|
|
$newcardbutton = dolGetButtonTitle($langs->trans('NewOrder'), '', 'fa fa-plus-circle', $url, '', $user->rights->fournisseur->commande->creer);
|
|
|
|
|
|
- // Fields title search
|
|
|
- print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
+ // Lines of title fields
|
|
|
+ print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
|
|
|
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
|
|
|
print '<input type="hidden" name="token" value="'.newToken().'">';
|
|
|
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
|
|
|
print '<input type="hidden" name="action" value="list">';
|
|
|
- print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|
|
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
|
|
|
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
|
|
|
+ print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
|
|
|
+ print '<input type="hidden" name="socid" value="'.$socid.'">';
|
|
|
|
|
|
print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'supplier_order', 0, $newcardbutton, '', $limit, 0, 0, 1);
|
|
|
|
|
@@ -674,11 +712,11 @@ if ($resql)
|
|
|
if ($massaction == 'createbills')
|
|
|
{
|
|
|
//var_dump($_REQUEST);
|
|
|
- print '<input type="hidden" name="massaction" value="confirm_createbills">';
|
|
|
+ print '<input type="hidden" name="massaction" value="confirm_createsupplierbills">';
|
|
|
|
|
|
- print '<table class="border" width="100%" >';
|
|
|
+ print '<table class="noborder" width="100%" >';
|
|
|
print '<tr>';
|
|
|
- print '<td class="titlefieldmiddle">';
|
|
|
+ print '<td class="titlefield">';
|
|
|
print $langs->trans('DateInvoice');
|
|
|
print '</td>';
|
|
|
print '<td>';
|
|
@@ -760,7 +798,17 @@ if ($resql)
|
|
|
|
|
|
$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
|
|
|
$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields
|
|
|
- if ($massactionbutton) $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
|
|
+ $selectedfields .= $form->showCheckAddButtons('checkforselect', 1);
|
|
|
+
|
|
|
+ if (GETPOST('autoselectall', 'int')) {
|
|
|
+ $selectedfields .= '<script>';
|
|
|
+ $selectedfields .= ' $(document).ready(function() {';
|
|
|
+ $selectedfields .= ' console.log("Autoclick on checkforselects");';
|
|
|
+ $selectedfields .= ' $("#checkforselects").click();';
|
|
|
+ $selectedfields .= ' $("#massaction").val("createbills").change();';
|
|
|
+ $selectedfields .= ' });';
|
|
|
+ $selectedfields .= '</script>';
|
|
|
+ }
|
|
|
|
|
|
print '<div class="div-table-responsive">';
|
|
|
print '<table class="tagtable liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
|
|
@@ -933,6 +981,7 @@ if ($resql)
|
|
|
|
|
|
print "</tr>\n";
|
|
|
|
|
|
+ // Fields title
|
|
|
print '<tr class="liste_titre">';
|
|
|
if (!empty($arrayfields['cf.ref']['checked'])) print_liste_field_titre($arrayfields['cf.ref']['label'], $_SERVER["PHP_SELF"], "cf.ref", "", $param, '', $sortfield, $sortorder);
|
|
|
if (!empty($arrayfields['cf.ref_supplier']['checked'])) print_liste_field_titre($arrayfields['cf.ref_supplier']['label'], $_SERVER["PHP_SELF"], "cf.ref_supplier", "", $param, '', $sortfield, $sortorder, 'tdoverflowmax100imp ');
|
|
@@ -983,6 +1032,12 @@ if ($resql)
|
|
|
{
|
|
|
$obj = $db->fetch_object($resql);
|
|
|
|
|
|
+ $notshippable = 0;
|
|
|
+ $warning = 0;
|
|
|
+ $text_info = '';
|
|
|
+ $text_warning = '';
|
|
|
+ $nbprod = 0;
|
|
|
+
|
|
|
$objectstatic->id = $obj->rowid;
|
|
|
$objectstatic->ref = $obj->ref;
|
|
|
$objectstatic->ref_supplier = $obj->ref_supplier;
|
|
@@ -1220,22 +1275,25 @@ if ($resql)
|
|
|
if (!$i) $totalarray['nbfield']++;
|
|
|
|
|
|
print "</tr>\n";
|
|
|
+
|
|
|
+ $total += $obj->total_ht;
|
|
|
+ $subtotal += $obj->total_ht;
|
|
|
$i++;
|
|
|
}
|
|
|
|
|
|
// Show total line
|
|
|
include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
|
|
|
|
|
|
+ $db->free($resql);
|
|
|
|
|
|
$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
|
|
|
$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook
|
|
|
print $hookmanager->resPrint;
|
|
|
|
|
|
- print "</table>\n";
|
|
|
- print '</div>';
|
|
|
- print "</form>\n";
|
|
|
+ print '</table>'."\n";
|
|
|
+ print '</div>';
|
|
|
|
|
|
- $db->free($resql);
|
|
|
+ print '</form>'."\n";
|
|
|
|
|
|
$hidegeneratedfilelistifempty = 1;
|
|
|
if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) $hidegeneratedfilelistifempty = 0;
|