Merge branch 'develop' into clean_phpstan_action
This commit is contained in:
commit
326cf42977
13 changed files with 81 additions and 31 deletions
|
|
@ -3044,7 +3044,7 @@ if ($action == 'create' && $usercancreate) {
|
|||
|
||||
// Cancel order
|
||||
if ($object->statut == Commande::STATUS_VALIDATED && !empty($usercancancel)) {
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'">'.$langs->trans("Cancel").'</a>';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&action=cancel&token='.newToken().'">'.$langs->trans("CancelOrder").'</a>';
|
||||
}
|
||||
|
||||
// Delete order
|
||||
|
|
|
|||
|
|
@ -1312,7 +1312,7 @@ if ($permissiontoclose) {
|
|||
$arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled");
|
||||
}
|
||||
if ($permissiontocancel) {
|
||||
$arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel");
|
||||
$arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("CancelOrder");
|
||||
}
|
||||
if (!empty($permissiontodelete)) {
|
||||
$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
|
||||
|
|
|
|||
|
|
@ -1290,6 +1290,9 @@ if ($resql) {
|
|||
$savnbfield = $totalarray['nbfield'];
|
||||
$totalarray = array();
|
||||
$totalarray['nbfield'] = 0;
|
||||
$totalarray['totaldeb'] = 0;
|
||||
$totalarray['totalcred'] = 0;
|
||||
|
||||
$imaxinloop = ($limit ? min($num, $limit) : $num);
|
||||
while ($i < $imaxinloop) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
|
|
|||
|
|
@ -374,9 +374,9 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||
$j -= 12;
|
||||
}
|
||||
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
|
||||
print '<td class="right" width="6%">'.price($totalpermonth[$j]).'</td>';
|
||||
print '<td class="right" width="6%">'.price((empty($totalpermonth[$j]) ? 0 : $totalpermonth[$j])).'</td>';
|
||||
}
|
||||
print '<td class="right" width="6%"><b>'.price($totalpermonth['total']).'</b></td>';
|
||||
print '<td class="right" width="6%"><b>'.price((empty($totalpermonth['total']) ? 0 : $totalpermonth['total'])).'</b></td>';
|
||||
print '</tr>';
|
||||
} else {
|
||||
print $db->lasterror(); // Show last sql error
|
||||
|
|
|
|||
|
|
@ -419,7 +419,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) {
|
|||
// Value turnover of month w/o VAT
|
||||
print '<td class="right">';
|
||||
if ($annee < $year_end || ($annee == $year_end && $mois <= $month_end)) {
|
||||
if ($cum_ht[$case]) {
|
||||
if (!empty($cum_ht[$case])) {
|
||||
$now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre.
|
||||
print '<a href="casoc.php?year='.$annee_decalage.'&month='.$mois_modulo.($modecompta ? '&modecompta='.$modecompta : '').'">'.price($cum_ht[$case], 1).'</a>';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -178,7 +178,6 @@ include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
|
|||
|
||||
// Purge search criteria
|
||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
|
||||
$search_categ = '';
|
||||
$search_user = '';
|
||||
$search_sale = '';
|
||||
$search_product_category = '';
|
||||
|
|
@ -274,9 +273,6 @@ $sql .= " typent.code as typent_code,";
|
|||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql .= " e.date_creation as date_creation, e.tms as date_update,";
|
||||
$sql .= " u.login";
|
||||
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
|
||||
$sql .= ", cc.fk_categorie, cc.fk_soc";
|
||||
}
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
|
|
@ -299,9 +295,6 @@ if ($search_all) {
|
|||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'commandedet as pd ON pd.rowid=ed.fk_origin_line';
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc";
|
||||
if (($search_categ_cus > 0) || ($search_categ_cus == -2)) {
|
||||
$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ
|
||||
}
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)";
|
||||
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)";
|
||||
|
|
@ -362,9 +355,6 @@ if ($search_tracking) {
|
|||
if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) {
|
||||
$sql .= " AND s.fk_typent IN (".$db->sanitize($search_type_thirdparty).')';
|
||||
}
|
||||
if ($search_sale > 0) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $search_sale);
|
||||
}
|
||||
if ($search_user > 0) {
|
||||
// The contact on a shipment is also the contact of the order.
|
||||
$sql .= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = eesource.fk_source AND ec.fk_socpeople = ".((int) $search_user);
|
||||
|
|
@ -395,11 +385,43 @@ if (getDolGlobalInt('MAIN_SUBMODULE_DELIVERY')) {
|
|||
if ($search_all) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
}
|
||||
if ($search_categ_cus > 0) {
|
||||
$sql .= " AND cc.fk_categorie = ".((int) $search_categ_cus);
|
||||
// Search on sale representative
|
||||
if ($search_sale && $search_sale != '-1') {
|
||||
if ($search_sale == -2) {
|
||||
$sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = e.fk_soc)";
|
||||
} elseif ($search_sale > 0) {
|
||||
$sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = e.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
|
||||
}
|
||||
}
|
||||
if ($search_categ_cus == -2) {
|
||||
$sql .= " AND cc.fk_categorie IS NULL";
|
||||
// Search for tag/category ($searchCategoryCustomerList is an array of ID)
|
||||
$searchCategoryCustomerOperator = -1;
|
||||
$searchCategoryCustomerList = array($search_categ_cus);
|
||||
if (!empty($searchCategoryCustomerList)) {
|
||||
$searchCategoryCustomerSqlList = array();
|
||||
$listofcategoryid = '';
|
||||
foreach ($searchCategoryCustomerList as $searchCategoryCustomer) {
|
||||
if (intval($searchCategoryCustomer) == -2) {
|
||||
$searchCategoryCustomerSqlList[] = "NOT EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc)";
|
||||
} elseif (intval($searchCategoryCustomer) > 0) {
|
||||
if ($searchCategoryCustomerOperator == 0) {
|
||||
$searchCategoryCustomerSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategoryCustomer).")";
|
||||
} else {
|
||||
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($listofcategoryid) {
|
||||
$searchCategoryCustomerSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
|
||||
}
|
||||
if ($searchCategoryCustomerOperator == 1) {
|
||||
if (!empty($searchCategoryCustomerSqlList)) {
|
||||
$sql .= " AND (".implode(' OR ', $searchCategoryCustomerSqlList).")";
|
||||
}
|
||||
} else {
|
||||
if (!empty($searchCategoryCustomerSqlList)) {
|
||||
$sql .= " AND (".implode(' AND ', $searchCategoryCustomerSqlList).")";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Search for tag/category ($searchCategoryProductList is an array of ID)
|
||||
$searchCategoryProductOperator = -1;
|
||||
|
|
@ -1179,7 +1201,7 @@ if ($num == 0) {
|
|||
$colspan++;
|
||||
}
|
||||
}
|
||||
print '<tr><td colspan="'.$colspan.'" class="opacitymedium">'.$langs->trans("NoRecordFound").'</td></tr>';
|
||||
print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
|
|
|
|||
|
|
@ -1361,9 +1361,9 @@ class FactureFournisseurRec extends CommonInvoice
|
|||
|
||||
if (!$error && $facturerec->generate_pdf) {
|
||||
// We refresh the object in order to have all necessary data (like date_lim_reglement)
|
||||
$laststep="Refresh {$new_fac_fourn->id}";
|
||||
$laststep="Refresh ".$new_fac_fourn->id;
|
||||
$new_fac_fourn->fetch($new_fac_fourn->id);
|
||||
$laststep="GenerateDocument {$new_fac_fourn->id}";
|
||||
$laststep="GenerateDocument ".$new_fac_fourn->id;
|
||||
$result = $new_fac_fourn->generateDocument($facturerec->model_pdf, $langs);
|
||||
if ($result < 0) {
|
||||
$this->errors = $new_fac_fourn->errors;
|
||||
|
|
|
|||
|
|
@ -2635,7 +2635,7 @@ if ($action == 'create') {
|
|||
//{
|
||||
if (isModEnabled("supplier_invoice") && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) { // statut 2 means approved, 7 means canceled
|
||||
if ($user->hasRight('fournisseur', 'facture', 'creer') || $user->hasRight("supplier_invoice", "creer")) {
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("CreateBill").'</a>';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&origin='.$object->element.'&originid='.$object->id.'&socid='.$object->socid.'">'.$langs->trans("SupplierOrderCreateBill").'</a>';
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
|
|
|||
|
|
@ -866,7 +866,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
if (!GETPOST('ref_supplier')) {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplier')), null, 'errors');
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplierBill')), null, 'errors');
|
||||
$action = 'create';
|
||||
$_GET['socid'] = $_POST['socid'];
|
||||
$error++;
|
||||
|
|
@ -1034,7 +1034,7 @@ if (empty($reshook)) {
|
|||
}
|
||||
|
||||
if (!GETPOST('ref_supplier')) {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplier')), null, 'errors');
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('RefSupplierBill')), null, 'errors');
|
||||
$action = 'create';
|
||||
$_GET['socid'] = $_POST['socid'];
|
||||
$error++;
|
||||
|
|
@ -2381,7 +2381,7 @@ if ($action == 'create') {
|
|||
}
|
||||
|
||||
// Ref supplier
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplier').'</td><td><input name="ref_supplier" value="'.(GETPOSTISSET('ref_supplier') ? GETPOST('ref_supplier') : (!empty($objectsrc->ref_supplier) ? $objectsrc->ref_supplier : '')).'" type="text"';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('RefSupplierBill').'</td><td><input name="ref_supplier" value="'.(GETPOSTISSET('ref_supplier') ? GETPOST('ref_supplier') : (!empty($objectsrc->ref_supplier) ? $objectsrc->ref_supplier : '')).'" type="text"';
|
||||
if (!empty($societe->id) && $societe->id > 0) {
|
||||
print ' autofocus';
|
||||
}
|
||||
|
|
@ -2961,7 +2961,7 @@ if ($action == 'create') {
|
|||
if ($action == 'clone') {
|
||||
// Create an array for form
|
||||
$formquestion = array(
|
||||
array('type' => 'text', 'name' => 'newsupplierref', 'label' => $langs->trans("RefSupplier"), 'value' => $langs->trans("CopyOf").' '.$object->ref_supplier),
|
||||
array('type' => 'text', 'name' => 'newsupplierref', 'label' => $langs->trans("RefSupplierBill"), 'value' => $langs->trans("CopyOf").' '.$object->ref_supplier),
|
||||
array('type' => 'date', 'name' => 'newdate', 'label' => $langs->trans("Date"), 'value' => dol_now())
|
||||
);
|
||||
// Ask confirmation to clone
|
||||
|
|
@ -3193,8 +3193,8 @@ if ($action == 'create') {
|
|||
|
||||
$morehtmlref = '<div class="refidno">';
|
||||
// Ref supplier
|
||||
$morehtmlref .= $form->editfieldkey("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
|
||||
$morehtmlref .= $form->editfieldkey("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref .= $form->editfieldval("RefSupplierBill", 'ref_supplier', $object->ref_supplier, $object, $usercancreate, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref .= '<br>'.$object->thirdparty->getNomUrl(1, 'supplier');
|
||||
if (!getDolGlobalString('MAIN_DISABLE_OTHER_LINK') && $object->thirdparty->id > 0) {
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ $socid = '';
|
|||
if (!empty($user->socid)) {
|
||||
$socid = $user->socid;
|
||||
}
|
||||
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
|
||||
$result = restrictedArea($user, 'fournisseur', 0, 'facture_fourn', 'facture');
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
|
|
|
|||
|
|
@ -268,6 +268,8 @@ NoDraftBills=No draft invoices
|
|||
NoOtherDraftBills=No other draft invoices
|
||||
NoDraftInvoices=No draft invoices
|
||||
RefBill=Invoice ref
|
||||
RefSupplierBill=Supplier invoice ref
|
||||
SupplierOrderCreateBill=Create invoice
|
||||
ToBill=To bill
|
||||
RemainderToBill=Remainder to bill
|
||||
SendBillByMail=Send invoice by email
|
||||
|
|
|
|||
|
|
@ -389,6 +389,10 @@ if ($id > 0 || !empty($ref)) {
|
|||
if (isModEnabled('stock')) {
|
||||
print '<td class="right">'.$langs->trans('Stock').'</td>';
|
||||
}
|
||||
// Hook fields
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
// Qty in kit
|
||||
print '<td class="right">'.$langs->trans('Qty').'</td>';
|
||||
// Stoc inc/dev
|
||||
|
|
@ -467,6 +471,11 @@ if ($id > 0 || !empty($ref)) {
|
|||
print '<td class="right">'.$value['stock'].'</td>'; // Real stock
|
||||
}
|
||||
|
||||
// Hook fields
|
||||
$parameters = array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $productstatic); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Qty + IncDec
|
||||
if ($user->hasRight('produit', 'creer') || $user->hasRight('service', 'creer')) {
|
||||
print '<td class="center"><input type="text" value="'.$nb_of_subproduct.'" name="TProduct['.$productstatic->id.'][qty]" class="right width40" /></td>';
|
||||
|
|
@ -517,6 +526,11 @@ if ($id > 0 || !empty($ref)) {
|
|||
print '<td></td>'; // Real stock
|
||||
}
|
||||
|
||||
// Hook fields
|
||||
$parameters = array();
|
||||
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $productstatic); // Note that $action and $object may have been modified by hook
|
||||
print $hookmanager->resPrint;
|
||||
|
||||
// Qty in kit
|
||||
print '<td class="right">'.dol_escape_htmltag($value['nb']).'</td>';
|
||||
|
||||
|
|
|
|||
|
|
@ -677,7 +677,16 @@ if ($search_ref_supplier) {
|
|||
if ($search_all) {
|
||||
$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
|
||||
}
|
||||
|
||||
// Search on sale representative
|
||||
/*
|
||||
if ($search_sale && $search_sale != '-1') {
|
||||
if ($search_sale == -2) {
|
||||
$sql .= " AND NOT EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc)";
|
||||
} elseif ($search_sale > 0) {
|
||||
$sql .= " AND EXISTS (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc WHERE sc.fk_soc = c.fk_soc AND sc.fk_user = ".((int) $search_sale).")";
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Add where from extra fields
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
|
||||
// Add where from hooks
|
||||
|
|
|
|||
Loading…
Reference in a new issue