2
0
forked from Wavyzz/dolibarr

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

This commit is contained in:
Laurent Destailleur
2020-06-17 19:27:39 +02:00
9 changed files with 7157 additions and 7148 deletions

View File

@@ -41,7 +41,7 @@ $action = GETPOST('action', 'aZ09');
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
$id = GETPOST('id', 'int'); // id of record
$mode = GETPOST('mode', 'aZ09'); // '' or 'tmp'
$mode = GETPOST('mode', 'aZ09'); // '' or '_tmp'
$piece_num = GETPOST("piece_num", 'int'); // id of transaction (several lines share the same transaction id)
// Security check

View File

@@ -1130,7 +1130,7 @@ class BookKeeping extends CommonObject
*
* @param User $user User that modifies
* @param bool $notrigger false=launch triggers after, true=disable triggers
* @param string $mode Mode
* @param string $mode Mode ('' or _tmp')
* @return int <0 if KO, >0 if OK
*/
public function update(User $user, $notrigger = false, $mode = '')
@@ -1257,12 +1257,12 @@ class BookKeeping extends CommonObject
}
/**
* Update movement
* Update accounting movement
*
* @param string $piece_num Piece num
* @param string $field Field
* @param string $value Value
* @param string $mode Mode
* @param string $mode Mode ('' or _tmp')
* @return number <0 if KO, >0 if OK
*/
public function updateByMvt($piece_num = '', $field = '', $value = '', $mode = '')
@@ -1271,9 +1271,9 @@ class BookKeeping extends CommonObject
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode." as ab";
$sql .= ' SET ab.'.$field.'='.(is_numeric($value) ? $value : "'".$this->db->escape($value)."'");
$sql .= ' WHERE ab.piece_num='.$piece_num;
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element.$mode;
$sql .= ' SET '.$field.'='.(is_numeric($value) ? $value : "'".$this->db->escape($value)."'");
$sql .= " WHERE piece_num = '".$this->db->escape($piece_num)."'";
$resql = $this->db->query($sql);
if (!$resql) {

View File

@@ -32,6 +32,7 @@ if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no
if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
if (!defined("NOLOGIN")) define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
if (!defined("NOSESSION")) define("NOSESSION", '1');
// Force entity if a value is provided into HTTP header. Otherwise, will use the entity of user of token used.
@@ -72,7 +73,8 @@ if (empty($conf->global->MAIN_MODULE_API))
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
print $langs->trans("WarningModuleNotActive", 'Api').'.<br><br>';
print $langs->trans("ToActivateModule");
exit;
//session_destroy();
exit(0);
}
// Test if explorer is not disabled
@@ -81,7 +83,8 @@ if (preg_match('/api\/index\.php\/explorer/', $url) && !empty($conf->global->API
$langs->load("admin");
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>';
exit;
//session_destroy();
exit(0);
}
@@ -138,7 +141,7 @@ if (!empty($conf->global->API_RESTRICT_ON_IP))
dol_syslog('Remote ip is '.$ipremote.', not into list '.$conf->global->API_RESTRICT_ON_IP);
print 'APIs are not allowed from the IP '.$ipremote;
header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
//print $conf->global->API_RESTRICT_ON_IP;
//session_destroy();
exit(0);
}
}
@@ -272,6 +275,7 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
dol_syslog('Failed to make include_once '.$dir_part_file, LOG_WARNING);
print 'API not found (failed to include API file)';
header('HTTP/1.1 501 API not found (failed to include API file)');
//session_destroy();
exit(0);
}
@@ -279,9 +283,16 @@ if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
$api->r->addAPIClass($classname);
}
//var_dump($api->r->apiVersionMap);
//exit;
// Call API (we suppose we found it).
// The handle will use the file api/temp/routes.php to get data to run the API. If the file exists and the entry for API is not found, it will return 404.
//Luracast\Restler\Defaults::$returnResponse = true;
//print $api->r->handle();
$api->r->handle();
//session_destroy();

View File

@@ -268,10 +268,10 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle
if ($offsetforchartofaccount > 0)
{
// Replace lines
// 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (1401, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);'
// 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', '0', '...', 1);'
// with
// 'INSERT INTO llx_accounting_account (__ENTITY__, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (1401 + 200100000, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', 0, '...', 1);'
$newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql);
// 'INSERT INTO llx_accounting_account (entity, rowid, fk_pcg_version, pcg_type, account_number, account_parent, label, active) VALUES (__ENTITY__, 1401 + 200100000, 'PCG99-ABREGE','CAPIT', 'XXXXXX', '1', '0', '...', 1);'
$newsql = preg_replace('/VALUES\s*\(__ENTITY__, \s*(\d+)\s*,(\s*\'[^\',]*\'\s*,\s*\'[^\',]*\'\s*,\s*\'?[^\',]*\'?\s*),\s*\'?([^\',]*)\'?/ims', 'VALUES (__ENTITY__, \1 + '.$offsetforchartofaccount.', \2, \3 + '.$offsetforchartofaccount, $newsql);
$newsql = preg_replace('/([,\s])0 \+ '.$offsetforchartofaccount.'/ims', '\1 0', $newsql);
//var_dump($newsql);
$arraysql[$i] = $newsql;

File diff suppressed because it is too large Load Diff

View File

@@ -63,6 +63,7 @@ ShipmentClassifyClosedInDolibarr=Shipment %s classified billed
ShipmentUnClassifyCloseddInDolibarr=Shipment %s classified re-open
ShipmentBackToDraftInDolibarr=Shipment %s go back to draft status
ShipmentDeletedInDolibarr=Shipment %s deleted
ReceptionValidatedInDolibarr=Reception %s validated
OrderCreatedInDolibarr=Order %s created
OrderValidatedInDolibarr=Order %s validated
OrderDeliveredInDolibarr=Order %s classified delivered

View File

@@ -213,13 +213,6 @@ session_name($sessionname);
if (!defined('NOSESSION'))
{
session_start();
/*if (ini_get('register_globals')) // Deprecated in 5.3 and removed in 5.4. To solve bug in using $_SESSION
{
foreach ($_SESSION as $key=>$value)
{
if (isset($GLOBALS[$key])) unset($GLOBALS[$key]);
}
}*/
}
// Init the 5 global objects, this include will make the 'new Xxx()' and set properties for: $conf, $db, $langs, $user, $mysoc

View File

@@ -2981,12 +2981,12 @@ class Societe extends CommonObject
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
* Returns an accounting code, following the accounting code module.
* May be identical to the one entered or generated automatically.
* To date only the automatic generation is implemented
* Assigns a accounting code from the accounting code module.
* Computed value is stored into this->code_compta or this->code_compta_fournisseur according to $type.
* May be identical to the one entered or generated automatically. Currently, only the automatic generation is implemented.
*
* @param string $type Type of thirdparty ('customer' or 'supplier')
* @return string Code compta si ok, 0 si aucun, <0 si ko
* @return int 0 if OK, <0 if $type is not valid
*/
public function get_codecompta($type)
{

View File

@@ -222,6 +222,11 @@ TITLE BUTTON
border: 1px solid var(--btncolorborder);
}
a.btnTitle.btnTitleSelected {
border: 1px solid #ccc;
border-radius: 3px;
}
.btnTitle > .btnTitle-icon{
}