Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into 19.0

This commit is contained in:
Laurent Destailleur
2024-03-27 17:59:10 +01:00
41 changed files with 210 additions and 138 deletions

View File

@@ -72,7 +72,7 @@ FIX: #yogosha21416
For users:
----------
NEW: Compatibility with PHP 8.2
NEW: Compatibility with PHP 8.2 (warning must be disabled)
NEW: Module Workstation (used to enhance the module BOM and Manufacturing Order) is now stable
NEW: Add a confirmation popup when deleting extrafields
NEW: Add type 'icon' type for extrafields

View File

@@ -128,6 +128,7 @@ $form = new Form($db);
// Page Header
$help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration';
$title = $langs->trans('ChartOfIndividualAccountsOfSubsidiaryLedger');
llxHeader('', $title, $help_url);
@@ -300,14 +301,17 @@ if ($resql) {
if ($limit > 0 && $limit != $conf->liste_limit) {
$param .= '&limit='.((int) $limit);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
}
if ($search_subaccount) {
$param .= '&search_subaccount='.urlencode($search_subaccount);
}
if ($search_label) {
$param .= '&search_label='.urlencode($search_label);
}
if ($optioncss != '') {
$param .= '&optioncss='.urlencode($optioncss);
if ($search_type) {
$param .= '&search_type='.urlencode($search_type);
}
// List of mass actions available
@@ -373,7 +377,7 @@ if ($resql) {
print '<tr class="liste_titre">';
// Action column
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
if (!empty($arrayfields['subaccount']['checked'])) {
print_liste_field_titre($arrayfields['subaccount']['label'], $_SERVER["PHP_SELF"], "subaccount", "", $param, '', $sortfield, $sortorder);
@@ -391,7 +395,7 @@ if ($resql) {
}
// Action column
if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ');
print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', $param, '', $sortfield, $sortorder, 'center maxwidthsearch ');
}
print "</tr>\n";

View File

@@ -473,9 +473,12 @@ if ($action != 'export_csv') {
$resql = $db->query($sql);
$nrows = $resql->num_rows;
$opening_balances = array();
for ($i = 0; $i < $nrows; $i++) {
$arr = $resql->fetch_array();
$opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance'];
if ($resql) {
$nrows = $db->num_rows($resql);
for ($i = 0; $i < $nrows; $i++) {
$arr = $db->fetch_array($resql);
$opening_balances["'" . $arr['numero_compte'] . "'"] = $arr['opening_balance'];
}
}
}

View File

@@ -360,14 +360,14 @@ if ($action == 'create') {
print '<tr><td class="fieldrequired">'.$langs->trans('Title').'</td>';
print '<td><input type="text" class="minwidth300" name="titre" value="'.dol_escape_htmltag(GETPOST("titre", 'alphanohtml')).'"></td><td>'.$langs->trans('DetailTitre').'</td></tr>';
// Picto
print '<tr><td class="fieldrequired">'.$langs->trans('Image').'</td>';
print '<td><input type="text" class="minwidth300" name="picto" value="'.dol_escape_htmltag(GETPOST("picto", 'alphanohtmlallowclass')).'"></td><td>'.$langs->trans('Example').': fa-global</td></tr>';
// URL
print '<tr><td class="fieldrequired">'.$langs->trans('URL').'</td>';
print '<td><input type="text" class="minwidth500" name="url" value="'.dol_escape_htmltag(GETPOST("url", 'alphanohtml')).'"></td><td>'.$langs->trans('DetailUrl').'</td></tr>';
// Picto
print '<tr><td class="fieldrequired">'.$langs->trans('Image').'</td>';
print '<td><input type="text" class="minwidth300" name="picto" value="'.dol_escape_htmltag(GETPOST("picto", 'alphanohtml')).'"></td><td>'.$langs->trans('Example').': fa-global</td></tr>';
// Langs
print '<tr><td>'.$langs->trans('LangFile').'</td>';
print '<td><input type="text" class="minwidth300" name="langs" value="'.dol_escape_htmltag($parent_langs).'"></td><td>'.$langs->trans('DetailLangs').'</td></tr>';

View File

@@ -53,7 +53,7 @@ $idproduct = GETPOST('idproduct', 'int');
* View
*/
top_httphead();
top_httphead('application/json');
if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire')) {
$product = new Product($db);
@@ -65,3 +65,24 @@ if ($action == 'getDurationUnitByProduct' && $user->hasRight('product', 'lire'))
echo json_encode($fk_unit);
exit();
}
if ($action == 'getWorkstationByProduct' && $user->hasRight('product', 'lire')) {
$product = new Product($db);
$res = $product->fetch($idproduct);
$result = array();
if ($res < 0) {
$error = 'SQL ERROR';
} elseif ($res == 0) {
$error = 'NOT FOUND';
} else {
$error = null;
$result['defaultWk']=$product->fk_default_workstation;
}
$result['error']=$error;
echo json_encode($result);
exit();
}

View File

@@ -792,7 +792,7 @@ class BOM extends CommonObject
$line->array_options[$key] = $array_options[$key];
}
}
if ($fk_default_workstation > 0 && $line->fk_default_workstation != $fk_default_workstation) {
if ($fk_default_workstation >= 0 && $line->fk_default_workstation != $fk_default_workstation) {
$line->fk_default_workstation = $fk_default_workstation;
}

View File

@@ -185,7 +185,7 @@ if ($filtertype != 1) {
$coldisplay++;
print '<td class="bordertop nobottom nowrap linecolworkstation right">';
print '&nbsp;';
print $formproduct->selectWorkstations('', 'idworkstations', 1);
print '</td>';
$coldisplay++;
@@ -235,14 +235,27 @@ jQuery(document).ready(function() {
,type: 'POST'
,data: {
'action': 'getDurationUnitByProduct'
,'token' : "<?php echo newToken() ?>"
,'idproduct' : idproduct
}
}).done(function(data) {
console.log(data);
var data = JSON.parse(data);
$("#fk_unit").val(data).change();
});
$.ajax({
url : "<?php echo dol_buildpath('/bom/ajax/ajax.php', 1); ?>"
,type: 'POST'
,data: {
'action': 'getWorkstationByProduct'
,'token' : "<?php echo newToken() ?>"
,'idproduct' : idproduct
}
}).done(function(data) {
$('#idworkstations').val(data.defaultWk).select2();
});
});
<?php } ?>
});

View File

@@ -267,7 +267,7 @@ if (empty($reshook)) {
$objectlabel = 'Events';
$uploaddir = true;
// Only users that can delete any event can remove records.
$permissiontodelete = $user->rights->agenda->allactions->delete;
$permissiontodelete = $user->hasRight('agenda', 'allactions', 'delete');
$permissiontoadd = $user->hasRight('agenda', 'myactions', 'create');
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
}
@@ -708,7 +708,7 @@ $url = DOL_URL_ROOT.'/comm/action/card.php?action=create';
$url .= '&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec;
$url .= '&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''));
$newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->rights->agenda->myactions->create || $user->hasRight('agenda', 'allactions', 'create'));
$newcardbutton = dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', $url, '', $user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create'));
$param .= '&mode='.$mode;

View File

@@ -4428,7 +4428,7 @@ class OrderLine extends CommonOrderLine
dol_syslog("OrderLine::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
if (!$resql) {
$this->error = $this->db->lasterror();
$error++;
}

View File

@@ -529,10 +529,10 @@ if (empty($numref)) {
print '<a href="'.DOL_URL_ROOT.'/compta/bank/line.php?rowid='.$objp->rowid.'&account='.$object->id.'">';
$reg = array();
preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthese on tente recherche de traduction
if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) {
if (!empty($reg[1]) && $langs->trans($reg[1]) != $reg[1]) {
print $langs->trans($reg[1]);
} else {
print $objp->label;
print dol_escape_htmltag($objp->label);
}
print '</a>';

View File

@@ -4031,7 +4031,7 @@ class Facture extends CommonInvoice
return -2;
}
} else {
$this->errors[]='status of invoice must be Draft to allow use of ->addline()';
$this->errors[] = 'status of invoice must be Draft to allow use of ->addline()';
dol_syslog(get_class($this)."::addline status of invoice must be Draft to allow use of ->addline()", LOG_ERR);
return -3;
}

View File

@@ -167,7 +167,6 @@ class box_external_rss extends ModeleBoxes
$title = preg_replace("/([[:alnum:]])\?([[:alnum:]])/", "\\1'\\2", $title); // Gere probleme des apostrophes mal codee/decodee par utf8
$title = preg_replace("/^\s+/", "", $title); // Supprime espaces de debut
$this->info_box_contents["$href"] = "$title";
$tooltip = $title;
$description = !empty($item['description']) ? $item['description'] : '';

View File

@@ -26,6 +26,9 @@ class FormSetup
*/
public $db;
/** @var int */
public $entity;
/** @var FormSetupItem[] */
public $items = array();
@@ -90,7 +93,8 @@ class FormSetup
*/
public function __construct($db, $outputLangs = null)
{
global $langs;
global $conf, $langs;
$this->db = $db;
$this->form = new Form($this->db);
@@ -99,6 +103,8 @@ class FormSetup
$this->formHiddenInputs['token'] = newToken();
$this->formHiddenInputs['action'] = 'update';
$this->entity = (is_null($this->entity) ? $conf->entity : $this->entity);
if ($outputLangs) {
$this->langs = $outputLangs;
} else {
@@ -454,6 +460,8 @@ class FormSetup
{
$item = new FormSetupItem($confKey);
$item->entity = $this->entity;
// set item rank if not defined as last item
if (empty($item->rank)) {
$item->rank = $this->getCurentItemMaxRank() + 1;
@@ -646,7 +654,7 @@ class FormSetupItem
/**
* Constructor
*
* @param string $confKey the conf key used in database
* @param string $confKey the conf key used in database
*/
public function __construct($confKey)
{
@@ -660,7 +668,7 @@ class FormSetupItem
}
$this->langs = $langs;
$this->entity = $conf->entity;
$this->entity = (is_null($this->entity) ? $conf->entity : ((int) $this->entity));
$this->confKey = $confKey;
$this->loadValueFromConf();
@@ -1119,7 +1127,7 @@ class FormSetupItem
$out.= $this->generateOutputFieldColor();
} elseif ($this->type == 'yesno') {
if (!empty($conf->use_javascript_ajax)) {
$out.= ajax_constantonoff($this->confKey);
$out.= ajax_constantonoff($this->confKey, array(), $this->entity); // TODO possibility to add $input parameter
} else {
if ($this->fieldValue == 1) {
$out.= $langs->trans('yes');

View File

@@ -158,8 +158,12 @@ abstract class Stats
dol_mkdir($conf->user->dir_temp);
}
$fp = fopen($newpathofdestfile, 'w');
fwrite($fp, json_encode($data));
fclose($fp);
if ($fp) {
fwrite($fp, json_encode($data));
fclose($fp);
} else {
dol_syslog("Failed to save cache file ".$newpathofdestfile);
}
dolChmod($newpathofdestfile);
$this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt;

View File

@@ -1279,9 +1279,9 @@ class DoliDBPgsql extends DoliDB
if (isset($field_desc['default']) && $field_desc['default'] != '') {
if ($field_desc['type'] == 'double' || $field_desc['type'] == 'tinyint' || $field_desc['type'] == 'int') {
$sql .= " DEFAULT ".$this->escape($field_desc['default']);
} elseif ($field_desc['type'] != 'text') {
$sql .= " DEFAULT '".$this->escape($field_desc['default'])."'"; // Default not supported on text fields
$sql .= ", ALTER COLUMN ".$this->escape($field_name)." SET DEFAULT ".((float) $field_desc['default']);
} elseif ($field_desc['type'] != 'text') { // Default not supported on text fields ?
$sql .= ", ALTER COLUMN ".$this->escape($field_name)." SET DEFAULT '".$this->escape($field_desc['default'])."'";
}
}

View File

@@ -184,7 +184,12 @@ class MenuManager
$substitarray['__USERID__'] = $user->id; // For backward compatibility
$val['url'] = make_substitutions($val['url'], $substitarray);
$relurl = dol_buildpath($val['url'], 1);
if (!preg_match('/^http/', $val['url'])) {
$relurl = dol_buildpath($val['url'], 1);
} else {
$relurl = $val['url'];
}
$canonurl = preg_replace('/\?.*$/', '', $val['url']);
print '<a class="alilevel0" href="#">';

View File

@@ -243,7 +243,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
$object->fetch_thirdparty();
$dir = $conf->facture->dir_output;
$dir = empty($conf->facture->multidir_output[$object->entity]) ? $conf->facture->dir_output : $conf->facture->multidir_output[$object->entity];
$objectref = dol_sanitizeFileName($object->ref);
if (!preg_match('/specimen/i', $objectref)) {
$dir .= "/".$objectref;

View File

@@ -89,7 +89,7 @@ class modStock extends DolibarrModules
$this->const[$r][0] = "MOUVEMENT_ADDON_PDF";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "stdmovement";
$this->const[$r][3] = 'Name of PDF model of stock mouvement';
$this->const[$r][3] = 'Name of PDF model of stock movement';
$this->const[$r][4] = 0;
$r++;
@@ -113,78 +113,82 @@ class modStock extends DolibarrModules
$this->rights = array();
$this->rights_class = 'stock';
$this->rights[0][0] = 1001;
$this->rights[0][1] = 'Lire les stocks';
$this->rights[0][2] = 'r';
$this->rights[0][3] = 0;
$this->rights[0][4] = 'lire';
$this->rights[0][5] = '';
$r = 0;
$this->rights[1][0] = 1002;
$this->rights[1][1] = 'Creer/Modifier les stocks';
$this->rights[1][2] = 'w';
$this->rights[1][3] = 0;
$this->rights[1][4] = 'creer';
$this->rights[1][5] = '';
$this->rights[$r][0] = 1001;
$this->rights[$r][1] = 'Read stocks';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'lire';
$this->rights[$r][5] = '';
$this->rights[2][0] = 1003;
$this->rights[2][1] = 'Supprimer les stocks';
$this->rights[2][2] = 'd';
$this->rights[2][3] = 0;
$this->rights[2][4] = 'supprimer';
$this->rights[2][5] = '';
$r++;
$this->rights[$r][0] = 1002;
$this->rights[$r][1] = 'Create/Modify stocks';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'creer';
$this->rights[$r][5] = '';
$this->rights[3][0] = 1004;
$this->rights[3][1] = 'Lire mouvements de stocks';
$this->rights[3][2] = 'r';
$this->rights[3][3] = 0;
$this->rights[3][4] = 'mouvement';
$this->rights[3][5] = 'lire';
$r++;
$this->rights[$r][0] = 1003;
$this->rights[$r][1] = 'Delete stock';
$this->rights[$r][2] = 'd';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'supprimer';
$this->rights[$r][5] = '';
$this->rights[4][0] = 1005;
$this->rights[4][1] = 'Creer/modifier mouvements de stocks';
$this->rights[4][2] = 'w';
$this->rights[4][3] = 0;
$this->rights[4][4] = 'mouvement';
$this->rights[4][5] = 'creer';
$r++;
$this->rights[$r][0] = 1004;
$this->rights[$r][1] = 'Read stock movements';
$this->rights[$r][2] = 'r';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'mouvement';
$this->rights[$r][5] = 'lire';
$this->rights[5][0] = 1011;
$this->rights[5][1] = 'inventoryReadPermission'; // Permission label
$this->rights[5][3] = 0; // Permission by default for new user (0/1)
$this->rights[5][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[5][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[$r][0] = 1005;
$this->rights[$r][1] = 'Create/modify stock movements';
$this->rights[$r][2] = 'w';
$this->rights[$r][3] = 0;
$this->rights[$r][4] = 'mouvement';
$this->rights[$r][5] = 'creer';
$this->rights[6][0] = 1012;
$this->rights[6][1] = 'inventoryCreatePermission'; // Permission label
$this->rights[6][3] = 0; // Permission by default for new user (0/1)
$this->rights[6][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[6][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[$r][0] = 1011;
$this->rights[$r][1] = 'inventoryReadPermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[6][0] = 1013;
$this->rights[6][1] = 'inventoryDeletePermission'; // Permission label
$this->rights[6][3] = 0; // Permission by default for new user (0/1)
$this->rights[6][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[6][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[$r][0] = 1012;
$this->rights[$r][1] = 'inventoryCreatePermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[$r][0] = 1013;
$this->rights[$r][1] = 'inventoryDeletePermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
$this->rights[8][0] = 1014;
$this->rights[8][1] = 'inventoryValidatePermission'; // Permission label
$this->rights[8][3] = 0; // Permission by default for new user (0/1)
$this->rights[8][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[8][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[$r][0] = 1014;
$this->rights[$r][1] = 'inventoryValidatePermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = 'validate'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[9][0] = 1015;
$this->rights[9][1] = 'inventoryChangePMPPermission'; // Permission label
$this->rights[9][3] = 0; // Permission by default for new user (0/1)
$this->rights[9][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[9][5] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[10][0] = 1016;
$this->rights[10][1] = 'inventoryDeletePermission'; // Permission label
$this->rights[10][3] = 0; // Permission by default for new user (0/1)
$this->rights[10][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[10][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$r++;
$this->rights[$r][0] = 1015;
$this->rights[$r][1] = 'inventoryChangePMPPermission'; // Permission label
$this->rights[$r][3] = 0; // Permission by default for new user (0/1)
$this->rights[$r][4] = 'inventory_advance'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
$this->rights[$r][5] = 'changePMP'; // In php code, permission will be checked by test if ($user->rights->permkey->level1->level2)
}
// Main menu entries

View File

@@ -119,7 +119,7 @@ class Cronjob extends CommonObject
public $lastoutput;
/**
* @var string Unit frequency of job execution
* @var int Unit frequency of job execution (60, 86400, ...)
*/
public $unitfrequency;

View File

@@ -474,11 +474,11 @@ class Export
case 'FormSelect':
//var_dump($NameField);
if ($InfoFieldList[1] == 'select_company') {
$szFilterField .= $form->select_company('', $NameField, '', 1);
$szFilterField .= $form->select_company('', $NameField, '', 1, 0, 0, [], 0, 'maxwidth200');
} elseif ($InfoFieldList[1] == 'selectcontacts') {
$szFilterField .= $form->selectcontacts(0, '', $NameField, '&nbsp;');
$szFilterField .= $form->selectcontacts(0, '', $NameField, '&nbsp;', '', '', 0, 'maxwidth200');
} elseif ($InfoFieldList[1] == 'select_dolusers') {
$szFilterField .= $form->select_dolusers('', $NameField, 1);
$szFilterField .= $form->select_dolusers('', $NameField, 1, null, 0, '', '', '', 0, 0, "", 0, "", "maxwidth200");
}
break;
case 'List':

View File

@@ -82,7 +82,8 @@ $result = @include_once $conffile; // Keep @ because with some error reporting t
$listofwrappers = stream_get_wrappers();
// We need '.phar' for geoip2. TODO Replace phar in geoip with exploded files so we can disable phar by default.
// phar stream does not auto unserialize content (possible code execution) since PHP 8.1
$arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftp', 'ftps', 'glob', 'data', 'expect', 'ogg', 'rar', 'zip', 'zlib');
// zip stream is necessary by excel import module
$arrayofstreamtodisable = array('compress.zlib', 'compress.bzip2', 'ftp', 'ftps', 'glob', 'data', 'expect', 'ogg', 'rar', 'zlib');
if (!empty($dolibarr_main_stream_to_disable) && is_array($dolibarr_main_stream_to_disable)) {
$arrayofstreamtodisable = $dolibarr_main_stream_to_disable;
}

View File

@@ -650,17 +650,17 @@ if (!empty($searchCategoryProductList)) {
$listofcategoryid = '';
foreach ($searchCategoryProductList as $searchCategoryProduct) {
if (intval($searchCategoryProduct) == -2) {
$searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product)";
$searchCategoryProductSqlList[] = "NOT EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product)";
} elseif (intval($searchCategoryProduct) > 0) {
if ($searchCategoryProductOperator == 0) {
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")";
} else {
$listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct);
}
}
}
if ($listofcategoryid) {
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND p.rowid = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
$searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."facture_fourn_det as fd WHERE fd.fk_facture_fourn = f.rowid AND fd.fk_product = ck.fk_product AND ck.fk_categorie IN (".$db->sanitize($listofcategoryid)."))";
}
if ($searchCategoryProductOperator == 1) {
if (!empty($searchCategoryProductSqlList)) {

View File

@@ -133,9 +133,9 @@ $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
// Permissions
$permissiontoread = $user->rights->hrm->all->read;
$permissiontoadd = $user->rights->hrm->all->write;
$permissiontodelete = $user->rights->hrm->all->delete;
$permissiontoread = $user->hasRight('hrm', 'all', 'read');
$permissiontoadd = $user->hasRight('hrm', 'all', 'write');
$permissiontodelete = $user->hasRight('hrm', 'all', 'delete');
// Security check (enable the most restrictive one)
if ($user->socid > 0) {

View File

@@ -134,9 +134,9 @@ $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position');
// Permissions
$permissiontoread = $user->rights->hrm->all->read;
$permissiontoadd = $user->rights->hrm->all->write;
$permissiontodelete = $user->rights->hrm->all->delete;
$permissiontoread = $user->hasRight('hrm', 'all', 'read');
$permissiontoadd = $user->hasRight('hrm', 'all', 'write');
$permissiontodelete = $user->hasRight('hrm', 'all', 'delete');
// Security check (enable the most restrictive one)
if ($user->socid > 0) {

View File

@@ -160,7 +160,7 @@ if ($id > 0 || $ref) {
$picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
print dol_get_fiche_head($head, 'agenda', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type = ".((int) $object->type);
$shownav = 1;

View File

@@ -232,7 +232,7 @@ if ($id > 0 || !empty($ref)) {
* Product card
*/
if ($user->hasRight('produit', 'lire') || $user->hasRight('service', 'lire')) {
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View File

@@ -239,7 +239,7 @@ if ($object->id) {
}
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type = ".((int) $object->type);
$shownav = 1;

View File

@@ -391,7 +391,7 @@ if ($id > 0 || $ref) {
print dol_get_fiche_head($head, 'suppliers', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type = ".((int) $object->type);
$shownav = 1;

View File

@@ -861,11 +861,11 @@ if ($type === "") {
$params['forcenohideoftext'] = 1;
}
$newcardbutton .= dolGetButtonTitleSeparator();
if ($type === "" || $type == Product::TYPE_PRODUCT) {
if ((isModEnabled('product') && $type === "") || $type == Product::TYPE_PRODUCT) {
$label = 'NewProduct';
$newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=0', '', $perm, $params);
}
if ($type === "" || $type == Product::TYPE_SERVICE) {
if ((isModEnabled('service') && $type === "") || $type == Product::TYPE_SERVICE) {
$label = 'NewService';
$newcardbutton .= dolGetButtonTitle($langs->trans($label), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/product/card.php?action=create&type=1', '', $perm, $params);
}

View File

@@ -122,7 +122,7 @@ if ($id > 0 || !empty($ref)) {
print dol_get_fiche_head($head, 'note', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type = ".((int) $object->type);
$shownav = 1;

View File

@@ -884,7 +884,7 @@ $picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
print dol_get_fiche_head($head, 'price', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$object->next_prev_filter = "fk_product_type = ".((int) $object->type);
$shownav = 1;

View File

@@ -151,7 +151,7 @@ if ($result && ($id > 0 || !empty($ref)) && empty($notab)) {
print dol_get_fiche_head($head, 'stats', $titre, -1, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
dol_banner_tab($object, 'ref', $linkback, ($user->socid ? 0 : 1), 'ref', '', '', '', 0, '', '', 1);

View File

@@ -164,7 +164,7 @@ if ($id > 0 || !empty($ref)) {
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
}
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View File

@@ -611,7 +611,7 @@ if ($id > 0 || $ref) {
dol_htmloutput_events();
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$shownav = 1;
if ($user->socid && !in_array('stock', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View File

@@ -212,7 +212,7 @@ if (!empty($object->multilangs)) {
print dol_get_fiche_head($head, 'translation', $titre, 0, $picto);
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?restore_lastsearch_values=1&type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
$shownav = 1;
if ($user->socid && !in_array('product', explode(',', getDolGlobalString('MAIN_MODULES_FOR_EXTERNAL')))) {

View File

@@ -2151,7 +2151,7 @@ if ($action != 'dopayment') {
if (getDolGlobalString('PAYPAL_API_INTEGRAL_OR_PAYPALONLY') != 'integral') {
print '<div style="line-height: 1em">&nbsp;</div>';
}
print '<span class="fa fa-paypal"></span> <input class="" type="submit" id="dopayment_paypal" name="dopayment_paypal" value="'.$langs->trans("PaypalDoPayment").'">';
print '<span class="fab fa-paypal"></span> <input class="" type="submit" id="dopayment_paypal" name="dopayment_paypal" value="'.$langs->trans("PaypalDoPayment").'">';
if (getDolGlobalString('PAYPAL_API_INTEGRAL_OR_PAYPALONLY') == 'integral') {
print '<br>';
print '<span class="buttonpaymentsmall">'.$langs->trans("CreditOrDebitCard").'</span><span class="buttonpaymentsmall"> - </span>';

View File

@@ -51,6 +51,8 @@ $langs->loadLangs(array("bills", "cashdesk"));
$place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : '0'); // $place is id of table for Bar or Restaurant
$invoiceid = GETPOST('invoiceid', 'int');
$idline = GETPOST('idline', 'int');
$action = GETPOST('action', 'aZ09');
@@ -60,12 +62,13 @@ if (!$user->hasRight('takepos', 'run')) {
// get invoice
$invoice = new Facture($db);
if ($place > 0) {
$invoice->fetch($place);
if ($invoiceid > 0) {
$invoice->fetch($invoiceid);
} else {
$invoice->fetch('', '(PROV-POS'.$_SESSION['takeposterminal'].'-'.$place.')');
}
// get default vat rate
$constforcompanyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION['takeposterminal'];
$soc = new Societe($db);
@@ -108,8 +111,8 @@ top_htmlhead('', '', 0, 0, $arrayofjs, $arrayofcss);
* Save (validate)
*/
function Save() {
console.log("We click so we call page invoice.php with place=<?php echo $place; ?> tva_tx="+vatRate);
parent.$("#poslines").load("invoice.php?action=freezone&token=<?php echo newToken(); ?>&place=<?php echo $place; ?>&number="+$('#number').val()+"&tva_tx="+vatRate, {desc:$('#desc').val()});
console.log("We click so we call page invoice.php with invoiceid=<?php echo $invoiceid; ?>, place=<?php echo $place; ?>, amount="+$("#number").val()+", tva_tx="+vatRate);
parent.$("#poslines").load("invoice.php?action=freezone&token=<?php echo newToken(); ?>&invoiceid=<?php echo $invoiceid; ?>&place=<?php echo $place; ?>&number="+$("#number").val()+"&tva_tx="+vatRate, {desc:$("#desc").val()});
parent.$.colorbox.close();
}

View File

@@ -73,7 +73,6 @@ if ($setcurrency != "") {
// We will recalculate amount for foreign currency at next call of invoice.php when $_SESSION["takeposcustomercurrency"] differs from invoice->multicurrency_code.
}
$_SESSION["urlfrom"] = '/takepos/index.php';
$langs->loadLangs(array("bills", "orders", "commercial", "cashdesk", "receiptprinter", "banks"));
@@ -532,11 +531,12 @@ function ClickProduct(position, qty = 1) {
}
else{
console.log($('#prodiv4').data('rowid'));
invoiceid = $("#invoiceid").val();
idproduct=$('#prodiv'+position).data('rowid');
console.log("Click on product at position "+position+" for idproduct "+idproduct+", qty="+qty);
console.log("Click on product at position "+position+" for idproduct "+idproduct+", qty="+qty+" invoicdeid="+invoiceid);
if (idproduct=="") return;
// Call page invoice.php to generate the section with product lines
$("#poslines").load("invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&qty="+qty, function() {
$("#poslines").load("invoice.php?action=addline&token=<?php echo newToken() ?>&place="+place+"&idproduct="+idproduct+"&qty="+qty+"&invoiceid="+invoiceid, function() {
<?php if (getDolGlobalString('TAKEPOS_CUSTOMER_DISPLAY')) {
echo "CustomerDisplay();";
}?>
@@ -556,8 +556,9 @@ function ChangeThirdparty(idcustomer) {
}
function deleteline() {
console.log("Delete line");
$("#poslines").load("invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline, function() {
invoiceid = $("#invoiceid").val();
console.log("Delete line invoiceid="+invoiceid);
$("#poslines").load("invoice.php?action=deleteline&token=<?php echo newToken(); ?>&place="+place+"&idline="+selectedline+"&invoiceid="+invoiceid, function() {
//$('#poslines').scrollTop($('#poslines')[0].scrollHeight);
});
ClearSearch();
@@ -603,8 +604,9 @@ function Floors() {
}
function FreeZone() {
console.log("Open box to enter a free product");
$.colorbox({href:"freezone.php?action=freezone&token=<?php echo newToken(); ?>&place="+place, width:"80%", height:"40%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone"); ?>"});
invoiceid = $("#invoiceid").val();
console.log("Open box to enter a free product on invoiceid="+invoiceid);
$.colorbox({href:"freezone.php?action=freezone&token=<?php echo newToken(); ?>&place="+place+"&invoiceid="+invoiceid, width:"80%", height:"40%", transition:"none", iframe:"true", title:"<?php echo $langs->trans("FreeZone"); ?>"});
}
function TakeposOrderNotes() {
@@ -1146,7 +1148,7 @@ if (!getDolGlobalString('TAKEPOS_HIDE_HEAD_BAR')) {
?>
<div class="login_block_user">
<?php
print top_menu_user(1);
print top_menu_user(1, DOL_URL_ROOT.'/user/logout.php?token='.newtoken().'&urlfrom='.urlencode('/takepos/?setterminal='.((int) $term)));
?>
</div>
</div>

View File

@@ -513,6 +513,7 @@ if (empty($reshook)) {
}
}
// If we add a line by click on product (invoice exists here because it was created juste before if it didn't exists)
if ($action == "addline" && ($user->hasRight('takepos', 'run') || defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE'))) {
$prod = new Product($db);
$prod->fetch($idproduct);
@@ -703,6 +704,7 @@ if (empty($reshook)) {
$invoice->fetch($placeid);
}
// If we add a line by submitting freezone form (invoice exists here because it was created juste before if it didn't exists)
if ($action == "freezone" && $user->hasRight('takepos', 'run')) {
$customer = new Societe($db);
$customer->fetch($invoice->socid);
@@ -720,7 +722,10 @@ if (empty($reshook)) {
$localtax1_tx = get_localtax($tva_tx, 1, $customer, $mysoc, $tva_npr);
$localtax2_tx = get_localtax($tva_tx, 2, $customer, $mysoc, $tva_npr);
$invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', 0, 0, 0, '', getDolGlobalInt('TAKEPOS_DISCOUNT_TTC') ? ($number >= 0 ? 'HT' : 'TTC') : (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') ? 'HT' : 'TTC'), $number, 0, -1, 0, '', 0, 0, null, '', '', 0, 100, '', null, 0);
$res = $invoice->addline($desc, $number, 1, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', 0, 0, 0, '', getDolGlobalInt('TAKEPOS_DISCOUNT_TTC') ? ($number >= 0 ? 'HT' : 'TTC') : (getDolGlobalInt('TAKEPOS_CHANGE_PRICE_HT') ? 'HT' : 'TTC'), $number, 0, -1, 0, '', 0, 0, null, '', '', 0, 100, '', null, 0);
if ($res < 0) {
dol_htmloutput_errors($invoice->error, $invoice->errors, 1);
}
$invoice->fetch($placeid);
}

View File

@@ -72,7 +72,7 @@ if ($reshook < 0) {
}
// Define url to go after disconnect
$urlfrom = empty($_SESSION["urlfrom"]) ? '' : $_SESSION["urlfrom"];
$urlfrom = empty($_SESSION["urlfrom"]) ? GETPOST('urlfrom') : $_SESSION["urlfrom"];
// Define url to go
$url = DOL_URL_ROOT."/index.php"; // By default go to login page

View File

@@ -160,7 +160,7 @@ class DoliDBTest extends PHPUnit\Framework\TestCase
print __METHOD__." result=".$result."\n";
// TODO Use $savtype and $savnull instead of hard coded
$field_desc = array('type'=>'varchar', 'value'=>'16', 'null'=>'NOT NULL');
$field_desc = array('type'=>'varchar', 'value'=>'16', 'null'=>'NOT NULL', 'default'=>'aaaabbbbccccdddd');
$result = $db->DDLUpdateField($db->prefix().'c_paper_format', 'code', $field_desc);
$this->assertEquals(1, $result);