mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-08 09:01:40 +01:00
Merge branch '22.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -162,6 +162,13 @@ if ($action == 'updateMask') {
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'updateoptions') {
|
||||
if (GETPOST('BOM_USE_SEARCH_TO_SELECT')) {
|
||||
$bomsearch = GETPOST('activate_BOM_USE_SEARCH_TO_SELECT', 'alpha');
|
||||
if (dolibarr_set_const($db, "BOM_USE_SEARCH_TO_SELECT", $bomsearch, 'chaine', 0, '', $conf->entity)) {
|
||||
$conf->global->BOM_USE_SEARCH_TO_SELECT = $bomsearch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -478,6 +485,30 @@ if (getDolGlobalString('MAIN_FEATURES_LEVEL') >= 1) {
|
||||
}
|
||||
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
print '<input type="hidden" name="action" value="updateoptions">';
|
||||
print '<td>'.$langs->trans("UseSearchToSelectBom").'</td>';
|
||||
if (!$conf->use_javascript_ajax) {
|
||||
print '<td></td>';
|
||||
print '<td class="nowrap right">';
|
||||
print $langs->trans("NotAvailableWhenAjaxDisabled");
|
||||
print "</td>";
|
||||
} else {
|
||||
print '<td class="right">';
|
||||
$arrval = array('0' => $langs->trans("No"),
|
||||
'1' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')',
|
||||
'2' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 2).')',
|
||||
'3' => $langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 3).')',
|
||||
);
|
||||
print $form->selectarray("activate_BOM_USE_SEARCH_TO_SELECT", $arrval, getDolGlobalString("BOM_USE_SEARCH_TO_SELECT")).'</td>';
|
||||
print '<td class="right"><input type="submit" class="button small reposition" name="BOM_USE_SEARCH_TO_SELECT" value="'.$langs->trans("Modify").'">';
|
||||
print "</td>";
|
||||
}
|
||||
print '</form>';
|
||||
print '</tr>';
|
||||
|
||||
$substitutionarray = pdf_getSubstitutionArray($langs, null, null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__'] = $langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
@@ -517,6 +548,8 @@ print '</form>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@@ -238,7 +238,7 @@ $sql .= " bd.rowid as boxid";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."boxes as b, ".MAIN_DB_PREFIX."boxes_def as bd";
|
||||
$sql .= " WHERE b.box_id = bd.rowid";
|
||||
$sql .= " AND b.entity IN (0,".$conf->entity.")";
|
||||
$sql .= " AND b.fk_user=0";
|
||||
$sql .= " AND b.fk_user = 0";
|
||||
$sql .= " ORDER by b.position, b.box_order";
|
||||
//print $sql;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
*/
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("install", "other", "admin", "products"));
|
||||
$langs->loadLangs(array("install", "other", "admin", "products", "mrp"));
|
||||
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
@@ -614,6 +614,27 @@ if ($resql) {
|
||||
print '<br>';
|
||||
$db->free($resql);
|
||||
}
|
||||
// Bom combo list
|
||||
$sql = "SELECT COUNT(*) as nb";
|
||||
$sql .= " FROM ".$db->prefix()."bom_bom as s";
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$limitforoptim = 5000;
|
||||
$num = $db->num_rows($resql);
|
||||
$obj = $db->fetch_object($resql);
|
||||
$nb = $obj->nb;
|
||||
if ($nb > $limitforoptim) {
|
||||
if (!getDolGlobalString('BOM_USE_SEARCH_TO_SELECT')) {
|
||||
print img_picto('', 'warning.png', 'class="pictofixedwidth"').' '.$langs->trans("YouHaveXObjectUseComboOptim", $nb, $langs->transnoentitiesnoconv("Bom"), 'BOM_USE_SEARCH_TO_SELECT');
|
||||
} else {
|
||||
print img_picto('', 'tick.png', 'class="pictofixedwidth"').' '.$langs->trans("YouHaveXObjectAndSearchOptimOn", $nb, $langs->transnoentitiesnoconv("Bom"), 'BOM_USE_SEARCH_TO_SELECT', getDolGlobalString('BOM_USE_SEARCH_TO_SELECT'));
|
||||
}
|
||||
} else {
|
||||
print img_picto('', 'tick.png', 'class="pictofixedwidth"').' '.$langs->trans("NbOfObjectIsLowerThanNoPb", $nb, $langs->transnoentitiesnoconv("Bom"));
|
||||
}
|
||||
print '<br>';
|
||||
$db->free($resql);
|
||||
}
|
||||
print '</div>';
|
||||
|
||||
|
||||
|
||||
@@ -90,9 +90,6 @@ if ($id == "" && $label == "") {
|
||||
// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('categorycard', 'globalcard'));
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'categorie', $id, '&category');
|
||||
|
||||
$object = new Categorie($db);
|
||||
$result = $object->fetch($id, $label);
|
||||
if ($result <= 0) {
|
||||
@@ -100,6 +97,9 @@ if ($result <= 0) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Security check
|
||||
$result = restrictedArea($user, 'categorie', $object->id, '&category');
|
||||
|
||||
$type = $object->type;
|
||||
if (is_numeric($type)) {
|
||||
$type = array_search($type, $object->MAP_ID); // For backward compatibility
|
||||
|
||||
@@ -434,7 +434,7 @@ if (GETPOSTINT('nomassaction') || in_array($massaction, array('presend', 'predel
|
||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||
|
||||
$sql = "SELECT";
|
||||
$sql .= " a.datep as dp, a.id, a.code, a.label, a.note, a.datep2 as dp2, a.fulldayevent, a.location,";
|
||||
$sql .= " a.datep as dp, a.id, a.code, a.label, a.note, a.datep2 as dp2, a.fulldayevent, a.location, a.entity,";
|
||||
$sql .= " a.fk_user_author, a.fk_user_action,";
|
||||
$sql .= " a.fk_contact, a.note, a.percent as percent,";
|
||||
$sql .= " a.fk_element, a.elementtype, a.datec, a.tms as datem,";
|
||||
|
||||
@@ -2308,8 +2308,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
||||
$style1 .= 'peruser_busy ';
|
||||
}
|
||||
foreach ($cases1[$h] as $id => $ev) {
|
||||
if ($ev['busy']) {
|
||||
$style1 .= 'peruser_busy ';
|
||||
if (!empty($ev['busy'])) {
|
||||
$style1 .= ' peruser_busy';
|
||||
}
|
||||
if (!empty($ev['css'])) {
|
||||
$style1 .= $ev['css'].' ';
|
||||
@@ -2328,8 +2328,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
||||
$style2 .= 'peruser_busy ';
|
||||
}
|
||||
foreach ($cases2[$h] as $id => $ev) {
|
||||
if ($ev['busy']) {
|
||||
$style2 .= 'peruser_busy ';
|
||||
if (!empty($ev['busy'])) {
|
||||
$style2 .= ' peruser_busy';
|
||||
}
|
||||
if (!empty($ev['css'])) {
|
||||
$style2 .= $ev['css'].' ';
|
||||
@@ -2348,8 +2348,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
||||
$style3 .= 'peruser_busy ';
|
||||
}
|
||||
foreach ($cases3[$h] as $id => $ev) {
|
||||
if ($ev['busy']) {
|
||||
$style3 .= 'peruser_busy ';
|
||||
if (!empty($ev['busy'])) {
|
||||
$style3 .= ' peruser_busy';
|
||||
}
|
||||
if (!empty($ev['css'])) {
|
||||
$style3 .= $ev['css'].' ';
|
||||
@@ -2368,8 +2368,8 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
||||
$style4 .= 'peruser_busy ';
|
||||
}
|
||||
foreach ($cases4[$h] as $id => $ev) {
|
||||
if ($ev['busy']) {
|
||||
$style4 .= 'peruser_busy ';
|
||||
if (!empty($ev['busy'])) {
|
||||
$style4 .= ' peruser_busy';
|
||||
}
|
||||
if (!empty($ev['css'])) {
|
||||
$style4 .= $ev['css'].' ';
|
||||
|
||||
@@ -384,37 +384,41 @@ $title = $langs->trans("Orders");
|
||||
$help_url = "EN:Module_Customers_Orders|FR:Module_Commandes_Clients|ES:Módulo_Pedidos_de_clientes";
|
||||
// llxHeader('',$title,$help_url);
|
||||
|
||||
$sql = 'SELECT';
|
||||
if ($search_all || $search_product_category_array > 0 || $search_user > 0) {
|
||||
$sql = 'SELECT DISTINCT';
|
||||
$sql = '';
|
||||
$sqlSelect = 'SELECT';
|
||||
|
||||
if ($search_all || !empty($search_product_category_array) || $search_user > 0) {
|
||||
$sqlSelect = 'SELECT DISTINCT';
|
||||
}
|
||||
$sql .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sql .= " typent.code as typent_code,";
|
||||
$sql .= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sql .= " country.code as country_code,";
|
||||
$sql .= ' c.rowid as c_rowid, c.ref, c.ref_client, c.fk_user_author,';
|
||||
$sql .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,';
|
||||
$sql .= ' c.total_ht as c_total_ht, c.total_tva as c_total_tva, c.total_ttc as c_total_ttc, c.fk_warehouse as warehouse,';
|
||||
$sql .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as delivery_date, c.fk_statut, c.facture as billed,';
|
||||
$sql .= ' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
|
||||
$sql .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
||||
$sql .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
|
||||
$sql .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
|
||||
$sql .= ' c.fk_input_reason, c.import_key,';
|
||||
$sqlSelect .= ' s.rowid as socid, s.nom as name, s.name_alias as alias, s.email, s.phone, s.fax, s.address, s.town, s.zip, s.fk_pays, s.client, s.code_client,';
|
||||
$sqlSelect .= " typent.code as typent_code,";
|
||||
$sqlSelect .= " state.code_departement as state_code, state.nom as state_name,";
|
||||
$sqlSelect .= " country.code as country_code,";
|
||||
$sqlSelect .= ' c.rowid as c_rowid, c.ref, c.ref_client, c.fk_user_author,';
|
||||
$sqlSelect .= ' c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva as multicurrency_total_vat, c.multicurrency_total_ttc,';
|
||||
$sqlSelect .= ' c.total_ht as c_total_ht, c.total_tva as c_total_tva, c.total_ttc as c_total_ttc, c.fk_warehouse as warehouse,';
|
||||
$sqlSelect .= ' c.date_valid, c.date_commande, c.note_public, c.note_private, c.date_livraison as delivery_date, c.fk_statut, c.facture as billed,';
|
||||
$sqlSelect .= ' c.date_creation as date_creation, c.tms as date_modification, c.date_cloture as date_cloture,';
|
||||
$sqlSelect .= ' p.rowid as project_id, p.ref as project_ref, p.title as project_label,';
|
||||
$sqlSelect .= ' u.login, u.lastname, u.firstname, u.email as user_email, u.statut as user_statut, u.entity, u.photo, u.office_phone, u.office_fax, u.user_mobile, u.job, u.gender,';
|
||||
$sqlSelect .= ' c.fk_cond_reglement,c.deposit_percent,c.fk_mode_reglement,c.fk_shipping_method,';
|
||||
$sqlSelect .= ' c.fk_input_reason, c.import_key,';
|
||||
// Lines or order
|
||||
$sql .= ' cdet.rowid, cdet.description, cdet.qty, cdet.product_type, cdet.fk_product, cdet.total_ht, cdet.total_tva, cdet.total_ttc,';
|
||||
$sql .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy';
|
||||
$sqlSelect .= ' cdet.rowid, cdet.description, cdet.qty, cdet.product_type, cdet.fk_product, cdet.total_ht, cdet.total_tva, cdet.total_ttc,';
|
||||
$sqlSelect .= ' pr.rowid as product_rowid, pr.ref as product_ref, pr.label as product_label, pr.barcode as product_barcode, pr.tobatch as product_batch, pr.tosell as product_status, pr.tobuy as product_status_buy';
|
||||
// Add fields from extrafields
|
||||
if (!empty($extrafields->attributes[$object->table_element]['label'])) {
|
||||
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
|
||||
$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
$sqlSelect .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
|
||||
}
|
||||
}
|
||||
|
||||
// Add fields from hooks
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
|
||||
$sql .= $hookmanager->resPrint;
|
||||
$sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$sqlSelect .= $hookmanager->resPrint;
|
||||
|
||||
$sql = ' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$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)";
|
||||
@@ -676,8 +680,13 @@ $sql .= $db->order($sortfield, $sortorder);
|
||||
// Count total nb of records
|
||||
$nbtotalofrecords = '';
|
||||
if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
$result = $db->query('SELECT COUNT(*) as numrows ' . $sql);
|
||||
$obj = $db->fetch_object($result);
|
||||
if (empty($obj)) {
|
||||
$nbtotalofrecords = 0;
|
||||
} else {
|
||||
$nbtotalofrecords = $obj->numrows;
|
||||
}
|
||||
|
||||
if (($page * $limit) > (int) $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
$page = 0;
|
||||
@@ -687,8 +696,7 @@ if (!getDolGlobalInt('MAIN_DISABLE_FULL_SCANLIST')) {
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
//print $sql;
|
||||
|
||||
$resql = $db->query($sql);
|
||||
$resql = $db->query($sqlSelect . $sql);
|
||||
if ($resql) {
|
||||
if ($socid > 0) {
|
||||
$soc = new Societe($db);
|
||||
|
||||
@@ -147,7 +147,8 @@ if ($usesublevelpermission && !isset($user->rights->$module->$element)) { // The
|
||||
$searchkey = (($id && GETPOST((string) $id, 'alpha')) ? GETPOST((string) $id, 'alpha') : (($htmlname && GETPOST($htmlname, 'alpha')) ? GETPOST($htmlname, 'alpha') : ''));
|
||||
|
||||
// Add a security test to avoid to get content of all tables
|
||||
if ($objecttmp !== null && !empty($objecttmp->module)) {
|
||||
$allowModules = ['bom'];
|
||||
if ($objecttmp !== null && !empty($objecttmp->module) && !in_array($objecttmp->module, $allowModules)) {
|
||||
restrictedArea($user, $objecttmp->module, $id, $objecttmp->table_element, $objecttmp->element);
|
||||
} else {
|
||||
restrictedArea($user, $objecttmp !== null ? $objecttmp->element : '', $id);
|
||||
|
||||
@@ -132,7 +132,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
|
||||
$HEIGHT = '192';
|
||||
|
||||
$stats = new FactureStats($this->db, $socid, $mode, 0);
|
||||
$stats->where = "f.fk_statut > 0";
|
||||
$stats->where = "f.entity IN (".getEntity('supplier_invoice').") AND f.fk_statut > 0";
|
||||
|
||||
// Build graphic number of object. $data = array(array('Lib',val1,val2,val3),...)
|
||||
if ($shownb) {
|
||||
|
||||
@@ -109,7 +109,8 @@ class box_graph_nb_ticket_last_x_days extends ModeleBoxes
|
||||
if ($user->hasRight('ticket', 'read')) {
|
||||
$sql = "SELECT CAST(t.datec AS DATE) as datec, COUNT(t.datec) as nb";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."ticket as t";
|
||||
$sql .= " WHERE CAST(t.datec AS DATE) > '".$this->db->idate($minimumdatec)."'";
|
||||
$sql .= " WHERE t.entity IN (".getEntity('ticket').")";
|
||||
$sql .= " AND CAST(t.datec AS DATE) > '".$this->db->idate($minimumdatec)."'";
|
||||
$sql .= " GROUP BY CAST(t.datec AS DATE)";
|
||||
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@@ -84,7 +84,8 @@ class box_graph_nb_tickets_type extends ModeleBoxes
|
||||
if ($user->hasRight('ticket', 'read')) {
|
||||
$sql = "SELECT ctt.rowid, ctt.label, ctt.code";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_ticket_type as ctt";
|
||||
$sql .= " WHERE ctt.active = 1";
|
||||
$sql .= " WHERE ctt.entity IN (".getEntity('c_ticket_type').")";
|
||||
$sql .= " AND ctt.active = 1";
|
||||
$sql .= $this->db->order('ctt.rowid', 'ASC');
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@@ -116,7 +117,8 @@ class box_graph_nb_tickets_type extends ModeleBoxes
|
||||
$data = array();
|
||||
$sql = "SELECT t.type_code, COUNT(t.type_code) as nb";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t";
|
||||
$sql .= " WHERE t.fk_statut <> 8";
|
||||
$sql .= " WHERE t.entity IN (".getEntity('ticket').")";
|
||||
$sql .= " AND t.fk_statut <> 8";
|
||||
$sql .= " GROUP BY t.type_code";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php";
|
||||
*/
|
||||
class box_graph_ticket_by_severity extends ModeleBoxes
|
||||
{
|
||||
public $boxcode = "box_ticket_by_severity";
|
||||
public $boxcode = "box_graph_ticket_by_severity";
|
||||
public $boximg = "ticket";
|
||||
/**
|
||||
* @var string
|
||||
@@ -96,7 +96,8 @@ class box_graph_ticket_by_severity extends ModeleBoxes
|
||||
if ($user->hasRight('ticket', 'read')) {
|
||||
$sql = "SELECT cts.rowid, cts.label, cts.code";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "c_ticket_severity as cts";
|
||||
$sql .= " WHERE cts.active = 1";
|
||||
$sql .= " WHERE cts.entity IN (".getEntity('c_ticket_severity').")";
|
||||
$sql .= " AND cts.active = 1";
|
||||
$sql .= $this->db->order('cts.rowid', 'ASC');
|
||||
$resql = $this->db->query($sql);
|
||||
|
||||
@@ -133,7 +134,8 @@ class box_graph_ticket_by_severity extends ModeleBoxes
|
||||
$data = array();
|
||||
$sql = "SELECT t.severity_code, COUNT(t.severity_code) as nb";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "ticket as t";
|
||||
$sql .= " WHERE t.fk_statut <> 8";
|
||||
$sql .= " WHERE t.entity IN (".getEntity('ticket').")";
|
||||
$sql .= " AND t.fk_statut <> 8";
|
||||
$sql .= " GROUP BY t.severity_code";
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql) {
|
||||
|
||||
@@ -3041,7 +3041,7 @@ class Form
|
||||
if (!$forcecombo) {
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$events = array();
|
||||
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("PRODUIT_USE_SEARCH_TO_SELECT"));
|
||||
$out .= ajax_combobox($htmlname, $events, getDolGlobalInt("BOM_USE_SEARCH_TO_SELECT"));
|
||||
}
|
||||
|
||||
$out .= '<select class="flat' . ($morecss ? ' ' . $morecss : '') . '" name="' . $htmlname . '" id="' . $htmlname . '">';
|
||||
@@ -9090,6 +9090,7 @@ class Form
|
||||
if ($prefixforautocompletemode == 'product') {
|
||||
$prefixforautocompletemode = 'produit';
|
||||
}
|
||||
|
||||
$confkeyforautocompletemode = strtoupper($prefixforautocompletemode) . '_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT
|
||||
|
||||
dol_syslog(get_class($this) . "::selectForForms filter=" . $filter, LOG_DEBUG);
|
||||
|
||||
@@ -16431,12 +16431,12 @@ function show_actions_messaging($conf, $langs, $db, $filterobj, $objcon = null,
|
||||
if (isset($histo[$key]['socpeopleassigned']) && is_array($histo[$key]['socpeopleassigned']) && count($histo[$key]['socpeopleassigned']) > 0) {
|
||||
$contactList = '';
|
||||
foreach ($histo[$key]['socpeopleassigned'] as $cid => $Tab) {
|
||||
if (empty($conf->cache['contact'][$histo[$key]['contact_id']])) {
|
||||
if (empty($conf->cache['contact'][$cid])) {
|
||||
$contact = new Contact($db);
|
||||
$contact->fetch($cid);
|
||||
$conf->cache['contact'][$histo[$key]['contact_id']] = $contact;
|
||||
$conf->cache['contact'][$cid] = $contact;
|
||||
} else {
|
||||
$contact = $conf->cache['contact'][$histo[$key]['contact_id']];
|
||||
$contact = $conf->cache['contact'][$cid];
|
||||
}
|
||||
|
||||
if ($contact) {
|
||||
|
||||
@@ -77,7 +77,7 @@ class ExportTsv extends ModeleExports
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs;
|
||||
global $langs;
|
||||
$this->db = $db;
|
||||
|
||||
$this->id = 'tsv'; // Same value then xxx in file name export_xxx.modules.php
|
||||
@@ -218,8 +218,6 @@ class ExportTsv extends ModeleExports
|
||||
public function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
|
||||
{
|
||||
// phpcs:enable
|
||||
$outputlangs->charset_output = getDolGlobalString('EXPORT_TSV_FORCE_CHARSET');
|
||||
|
||||
$selectlabel = array();
|
||||
foreach ($array_selected_sorted as $code => $value) {
|
||||
if (strpos($code, ' as ') == 0) {
|
||||
@@ -232,8 +230,12 @@ class ExportTsv extends ModeleExports
|
||||
continue;
|
||||
}
|
||||
|
||||
$newvalue = $outputlangs->transnoentities($array_export_fields_label[$code]); // newvalue is now $outputlangs->charset_output encoded
|
||||
$newvalue = $this->tsv_clean($newvalue, $outputlangs->charset_output);
|
||||
$newvalue = $array_export_fields_label[$code];
|
||||
if ($newvalue) {
|
||||
$newvalue = $outputlangs->transnoentitiesnoconv($newvalue);
|
||||
}
|
||||
|
||||
$newvalue = $this->tsv_clean($newvalue, getDolGlobalString('EXPORT_TSV_FORCE_CHARSET'));
|
||||
|
||||
fwrite($this->handle, $newvalue.$this->separator);
|
||||
$typefield = isset($array_types[$code]) ? $array_types[$code] : '';
|
||||
@@ -347,9 +349,17 @@ class ExportTsv extends ModeleExports
|
||||
* @param string $charset Input AND Output character set
|
||||
* @return string Value cleaned
|
||||
*/
|
||||
public function tsv_clean($newvalue, $charset)
|
||||
public function tsv_clean($newvalue, $charset = '')
|
||||
{
|
||||
// phpcs:enable
|
||||
global $langs;
|
||||
|
||||
if (empty($charset)) {
|
||||
$charset = getDolGlobalString('EXPORT_TSV_FORCE_CHARSET');
|
||||
}
|
||||
|
||||
$newvalue = $langs->convToOutputCharset($newvalue, 'UTF-8', $charset); // newvalue is now encoded into $charset
|
||||
|
||||
|
||||
// Rule Dolibarr: No HTML
|
||||
$newvalue = dol_string_nohtmltag($newvalue, 1, $charset);
|
||||
|
||||
@@ -194,8 +194,6 @@ class ExportCsv extends ModeleExports
|
||||
public function write_title($array_export_fields_label, $array_selected_sorted, $outputlangs, $array_types)
|
||||
{
|
||||
// phpcs:enable
|
||||
$outputlangs->charset_output = getDolGlobalString('EXPORT_CSV_FORCE_CHARSET');
|
||||
|
||||
$selectlabel = array();
|
||||
foreach ($array_selected_sorted as $code => $value) {
|
||||
if (strpos($code, ' as ') == 0) {
|
||||
@@ -209,10 +207,13 @@ class ExportCsv extends ModeleExports
|
||||
}
|
||||
|
||||
$newvalue = $array_export_fields_label[$code];
|
||||
if ($newvalue) {
|
||||
$newvalue = $outputlangs->transnoentitiesnoconv($newvalue);
|
||||
}
|
||||
|
||||
// Clean data and add encloser if required (depending on value of USE_STRICT_CSV_RULES)
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$newvalue = csvClean($newvalue, $outputlangs->charset_output, $this->separator);
|
||||
$newvalue = csvClean($newvalue, getDolGlobalString('EXPORT_CSV_FORCE_CHARSET'), $this->separator);
|
||||
|
||||
fwrite($this->handle, $newvalue.$this->separator);
|
||||
$typefield = isset($array_types[$code]) ? $array_types[$code] : '';
|
||||
|
||||
@@ -211,7 +211,7 @@ class modTicket extends DolibarrModules
|
||||
$this->boxes = array(
|
||||
0 => array('file' => 'box_last_ticket.php', 'enabledbydefaulton' => 'Home'),
|
||||
1 => array('file' => 'box_last_modified_ticket.php', 'enabledbydefaulton' => 'Home'),
|
||||
2 => array('file' => 'box_ticket_by_severity.php', 'enabledbydefaulton' => 'ticketindex'),
|
||||
2 => array('file' => 'box_graph_ticket_by_severity.php', 'enabledbydefaulton' => 'ticketindex'),
|
||||
3 => array('file' => 'box_graph_nb_ticket_last_x_days.php', 'enabledbydefaulton' => 'ticketindex'),
|
||||
4 => array('file' => 'box_graph_nb_tickets_type.php', 'enabledbydefaulton' => 'ticketindex'),
|
||||
5 => array('file' => 'box_new_vs_close_ticket.php', 'enabledbydefaulton' => 'ticketindex')
|
||||
|
||||
@@ -270,7 +270,7 @@ if (is_resource($handle)) {
|
||||
print '</td>';
|
||||
} else {
|
||||
print "<td class=\"center\">\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"), 'switch_on').'</a>';
|
||||
print '</td>';
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -80,7 +80,7 @@ class Export
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public $array_export_label = array(); // Tableau de "libelle de lots"
|
||||
public $array_export_label = array(); // Array of "Translation key" to use for each export profile
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
@@ -117,7 +117,7 @@ class Export
|
||||
/**
|
||||
* @var array<array<array{rule:string,file:string,classfile:string,class:string,method:string,method_params:string[]}>>
|
||||
*/
|
||||
public $array_export_special = array(); // array of special operations to do on field
|
||||
public $array_export_special = array(); // array of special operations to do on fields
|
||||
/**
|
||||
* @var array<array<string,string>>
|
||||
*/
|
||||
@@ -269,13 +269,13 @@ class Export
|
||||
$this->array_export_perms[$i] = $bool;
|
||||
// Icon
|
||||
$this->array_export_icon[$i] = (isset($module->export_icon[$r]) ? $module->export_icon[$r] : $module->picto);
|
||||
// Code of the export dataset / Code du dataset export
|
||||
// Code of the export dataset
|
||||
$this->array_export_code[$i] = $module->export_code[$r];
|
||||
// Define a key for sort
|
||||
$this->array_export_code_for_sort[$i] = $module->module_position.'_'.$module->export_code[$r]; // Add a key into the module
|
||||
// Export Dataset Label / Libelle du dataset export
|
||||
// Export Dataset Label
|
||||
$this->array_export_label[$i] = $module->getExportDatasetLabel($r);
|
||||
// Table of fields to export / Tableau des champ a exporter (cle=champ, valeur=libelle)
|
||||
// Table of fields to export
|
||||
$this->array_export_fields[$i] = $module->export_fields_array[$r];
|
||||
// Table of fields to be filtered (key=field, value1=data type) Verifies that the module has filters
|
||||
$this->array_export_TypeFields[$i] = (isset($module->export_TypeFields_array[$r]) ? $module->export_TypeFields_array[$r] : '');
|
||||
@@ -283,7 +283,7 @@ class Export
|
||||
$this->array_export_entities[$i] = $module->export_entities_array[$r];
|
||||
// Table of entities requiring to abandon DISTINCT (key=entity, valeur=field id child records)
|
||||
$this->array_export_dependencies[$i] = (!empty($module->export_dependencies_array[$r]) ? $module->export_dependencies_array[$r] : '');
|
||||
// Table of special field operations / Tableau des operations speciales sur champ
|
||||
// Table of special field operations
|
||||
$this->array_export_special[$i] = (!empty($module->export_special_array[$r]) ? $module->export_special_array[$r] : '');
|
||||
// Array of examples
|
||||
$this->array_export_examplevalues[$i] = (!empty($module->export_examplevalues_array[$r]) ? $module->export_examplevalues_array[$r] : null);
|
||||
|
||||
@@ -149,6 +149,7 @@ $entitytolang = array(
|
||||
'inventory_line' => 'InventoryLine'
|
||||
);
|
||||
|
||||
|
||||
$array_selected = isset($_SESSION["export_selected_fields"]) ? $_SESSION["export_selected_fields"] : array();
|
||||
$array_filtervalue = isset($_SESSION["export_filtered_fields"]) ? $_SESSION["export_filtered_fields"] : array();
|
||||
$datatoexport = GETPOST("datatoexport", "aZ09");
|
||||
@@ -163,6 +164,7 @@ $field = GETPOST("field", "alpha");
|
||||
$objexport = new Export($db);
|
||||
$objexport->load_arrays($user, $datatoexport);
|
||||
|
||||
|
||||
$objmodelexport = new ModeleExports($db);
|
||||
$form = new Form($db);
|
||||
$htmlother = new FormOther($db);
|
||||
|
||||
@@ -170,3 +170,4 @@ ErrorModifyMoDateEnd = You must choose an end date later than the start date. %s
|
||||
ErrorCancelMo=Error updating cancellation
|
||||
ErrorModifyMoDate=Error updating date modification
|
||||
BOM_SUB_BOM=Use sub-boms
|
||||
UseSearchToSelectBom=Wait until a key is pressed before loading content of Boms combo list.<br>This may improve performance if you have a large number of projects, but it is less convenient.
|
||||
|
||||
@@ -169,3 +169,4 @@ ErrorModifyMoDateStart = Vous devez choisir une date de début antérieure à la
|
||||
ErrorModifyMoDateEnd = Vous devez choisir une date de fin postérieure à la date de début. %s
|
||||
ErrorCancelMo=Erreur lors de la mise à jour de l'annulation
|
||||
ErrorModifyMoDate=Erreur lors de la mise à jour de la modification de la date
|
||||
UseSearchToSelectBom=Attendre que vous ayez appuyé sur une touche avant de charger le contenu de la liste déroulante des nomenclatures (Cela peut augmenter les performances si vous avez un grand nombre de nomenclatures, mais cela est moins convivial)
|
||||
@@ -554,6 +554,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
print '<input type="hidden" name="action" value="save_composed_product" />';
|
||||
print '<input type="hidden" name="id" value="'.$id.'" />';
|
||||
|
||||
print '<div class="div-table-responsive-no-min">';
|
||||
print '<table id="tablelines" class="ui-sortable liste noborder nobottom">';
|
||||
|
||||
print '<tr class="liste_titre nodrag nodrop">';
|
||||
@@ -793,6 +794,7 @@ if ($id > 0 || !empty($ref)) {
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
/*if($user->rights->produit->creer || $user->hasRight('service', 'creer')) {
|
||||
print '<input type="submit" class="button button-save" value="'.$langs->trans("Save").'">';
|
||||
|
||||
@@ -520,52 +520,6 @@ if (empty($reshook)) {
|
||||
// If price has changed, we update it
|
||||
if (!array_key_exists($key, $object->multiprices) || $object->multiprices[$key] != $newprice || $object->multiprices_min[$key] != $newprice_min || $object->multiprices_base_type[$key] != $val['price_base_type'] || $object->multiprices_tva_tx[$key] != $newvattx) {
|
||||
$res = $object->updatePrice((float) $newprice, $val['price_base_type'], $user, (float) $val['vat_tx'], (float) $newprice_min, $key, $val['npr'], $psq, 0, $val['localtaxes_array'], $val['default_vat_code'], $val['price_label']);
|
||||
if ($res > 0) {
|
||||
$extralabels = $extrafields->fetch_name_optionals_label("product");
|
||||
if (!getDolGlobalString('PRODUIT_MULTIPRICES') && !getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES') && !empty($extralabels)) {
|
||||
// Default price
|
||||
$extrafield_values = $extrafields->getOptionalsFromPost("product");
|
||||
foreach ($extrafield_values as $efkey => $value) {
|
||||
$object->array_options[$efkey] = $value;
|
||||
}
|
||||
$result = $object->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
} elseif ((getDolGlobalString('PRODUIT_MULTIPRICES') || getDolGlobalString('PRODUIT_CUSTOMER_PRICES_AND_MULTIPRICES')) && !empty($extralabels)) {
|
||||
$price_extralabels = $extrafields->fetch_name_optionals_label("product_price");
|
||||
$sql = "SELECT rowid";
|
||||
$sql .= " FROM ".$object->db->prefix()."product_price";
|
||||
$sql .= " WHERE entity IN (".getEntity('productprice').")";
|
||||
$sql .= " AND price_level=".((int) $key); // $i
|
||||
$sql .= " AND fk_product = ".((int) $object->id);
|
||||
$sql .= " ORDER BY date_price DESC, rowid DESC";
|
||||
$sql .= " LIMIT 1";
|
||||
$resql = $object->db->query($sql);
|
||||
if ($resql) {
|
||||
$lineid = $object->db->fetch_object($resql);
|
||||
$db->free($resql);
|
||||
}
|
||||
if (!empty($lineid->rowid)) {
|
||||
if (!empty($price_extralabels) && is_array($price_extralabels)) {
|
||||
foreach ($price_extralabels as $code => $label) {
|
||||
$code_array = GETPOST($code, 'array');
|
||||
$object->array_options['options_'.$code] = $code_array[$key];
|
||||
}
|
||||
// We need to force table to update product_price and not product extrafields
|
||||
$object->id = $lineid->rowid;
|
||||
$object->table_element = 'product_price';
|
||||
$result = $object->insertExtraFields();
|
||||
}
|
||||
// Back to product table
|
||||
$object->id = $id;
|
||||
$object->table_element = 'product';
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$res = 0;
|
||||
}
|
||||
|
||||
@@ -457,6 +457,9 @@ if (empty($reshook)) {
|
||||
|
||||
if (($action == "confirm_close" || $action == "confirm_abandon") && GETPOST('confirm', 'alpha') == 'yes' && $permissiontoadd) {
|
||||
$object->fetch(GETPOSTINT('id'), '', GETPOST('track_id', 'alpha'));
|
||||
if (GETPOSTISSET('contactid')) {
|
||||
$object->context['contact_id'] = GETPOSTINT('contactid');
|
||||
}
|
||||
|
||||
if ($object->close($user, ($action == "confirm_abandon" ? 1 : 0))) { // Test on pemrission already done
|
||||
setEventMessages($langs->trans('TicketMarkedAsClosed'), null, 'mesgs');
|
||||
|
||||
@@ -237,11 +237,15 @@ $permsgroupbyentity = array();
|
||||
$sql = "SELECT DISTINCT gr.fk_id, gu.entity"; // fk_id are permission id and entity is entity of the group
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."usergroup_rights as gr,";
|
||||
$sql .= " ".MAIN_DB_PREFIX."usergroup_user as gu"; // all groups of a user
|
||||
$sql .= " WHERE gr.entity = ".((int) $entity);
|
||||
$sql .= " WHERE gr.entity = ".((int) $entity); // it's very important, don't change please !
|
||||
// The entity on the table gu=usergroup_user should be useless and should never be used because it is already into gr and r.
|
||||
// but when using MULTICOMPANY_TRANSVERSE_MODE, we may have inserted record that make rubbish result here due to the duplicate record of
|
||||
// other entities, so we are forced to add a filter on gu here
|
||||
$sql .= " AND gu.entity IN (0,".$conf->entity.")";
|
||||
if (getDolGlobalString("MULTICOMPANY_TRANSVERSE_MODE_FIX_WHEN_GU_CONTAINS_0")) {
|
||||
$sql .= " AND gu.entity IN (0,". ((int) $entity).")";
|
||||
} else {
|
||||
$sql .= " AND gu.entity = ".((int) $entity);
|
||||
}
|
||||
$sql .= " AND gr.fk_usergroup = gu.fk_usergroup";
|
||||
$sql .= " AND gu.fk_user = ".((int) $object->id);
|
||||
|
||||
|
||||
@@ -1279,6 +1279,11 @@ class Website extends CommonObject
|
||||
$error = 0;
|
||||
|
||||
$pathtofile = dol_sanitizePathName($pathtofile);
|
||||
if (!file_exists($pathtofile)) {
|
||||
$this->error = 'The zip file "'.$pathtofile.'" is not found';
|
||||
return -9;
|
||||
}
|
||||
|
||||
$object = $this;
|
||||
if (empty($object->ref)) {
|
||||
$this->error = 'Function importWebSite called on object not loaded (object->ref is empty)';
|
||||
|
||||
Reference in New Issue
Block a user