Merge branch '9.0' into 9.0_FEC
This commit is contained in:
commit
bb168d7f54
@ -324,8 +324,8 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ", piece_num";
|
$sql .= ", piece_num";
|
||||||
$sql .= ', entity';
|
$sql .= ', entity';
|
||||||
$sql .= ") VALUES (";
|
$sql .= ") VALUES (";
|
||||||
$sql .= "'" . $this->db->idate($this->doc_date) . "'";
|
$sql .= "'".$this->db->idate($this->doc_date)."'";
|
||||||
$sql .= ", ".(! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'");
|
$sql .= ", ".(! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'".$this->db->idate($this->date_lim_reglement)."'");
|
||||||
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
$sql .= ",'" . $this->db->escape($this->doc_type) . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
$sql .= ",'" . $this->db->escape($this->doc_ref) . "'";
|
||||||
$sql .= "," . $this->fk_doc;
|
$sql .= "," . $this->fk_doc;
|
||||||
@ -341,7 +341,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= "," . $this->montant;
|
$sql .= "," . $this->montant;
|
||||||
$sql .= ",'" . $this->db->escape($this->sens) . "'";
|
$sql .= ",'" . $this->db->escape($this->sens) . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->fk_user_author) . "'";
|
$sql .= ",'" . $this->db->escape($this->fk_user_author) . "'";
|
||||||
$sql .= ",'" . $this->db->idate($now). "'";
|
$sql .= ",'".$this->db->idate($now)."'";
|
||||||
$sql .= ",'" . $this->db->escape($this->code_journal) . "'";
|
$sql .= ",'" . $this->db->escape($this->code_journal) . "'";
|
||||||
$sql .= ",'" . $this->db->escape($this->journal_label) . "'";
|
$sql .= ",'" . $this->db->escape($this->journal_label) . "'";
|
||||||
$sql .= "," . $this->db->escape($this->piece_num);
|
$sql .= "," . $this->db->escape($this->piece_num);
|
||||||
@ -574,7 +574,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= 'piece_num,';
|
$sql .= 'piece_num,';
|
||||||
$sql .= 'entity';
|
$sql .= 'entity';
|
||||||
$sql .= ') VALUES (';
|
$sql .= ') VALUES (';
|
||||||
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'" . $this->db->idate($this->doc_date) . "'") . ',';
|
$sql .= ' ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) == 0 ? 'NULL' : "'".$this->db->idate($this->doc_date)."'") . ',';
|
||||||
$sql .= ' ' . (! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'") . ',';
|
$sql .= ' ' . (! isset($this->date_lim_reglement) || dol_strlen($this->date_lim_reglement) == 0 ? 'NULL' : "'" . $this->db->idate($this->date_lim_reglement) . "'") . ',';
|
||||||
$sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ',';
|
$sql .= ' ' . (! isset($this->doc_type) ? 'NULL' : "'" . $this->db->escape($this->doc_type) . "'") . ',';
|
||||||
$sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
|
$sql .= ' ' . (! isset($this->doc_ref) ? 'NULL' : "'" . $this->db->escape($this->doc_ref) . "'") . ',';
|
||||||
@ -591,7 +591,7 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ',';
|
$sql .= ' ' . (! isset($this->montant) ? 'NULL' : $this->montant ). ',';
|
||||||
$sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
|
$sql .= ' ' . (! isset($this->sens) ? 'NULL' : "'" . $this->db->escape($this->sens) . "'") . ',';
|
||||||
$sql .= ' ' . $user->id . ',';
|
$sql .= ' ' . $user->id . ',';
|
||||||
$sql .= ' ' . "'" . $this->db->idate($now) . "',";
|
$sql .= ' ' . "'".$this->db->idate($now)."',";
|
||||||
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
|
$sql .= ' ' . (empty($this->code_journal) ? 'NULL' : "'" . $this->db->escape($this->code_journal) . "'") . ',';
|
||||||
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
|
$sql .= ' ' . (empty($this->journal_label) ? 'NULL' : "'" . $this->db->escape($this->journal_label) . "'") . ',';
|
||||||
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';
|
$sql .= ' ' . (empty($this->piece_num) ? 'NULL' : $this->db->escape($this->piece_num)).',';
|
||||||
@ -1164,7 +1164,7 @@ class BookKeeping extends CommonObject
|
|||||||
|
|
||||||
// Update request
|
// Update request
|
||||||
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . $mode.' SET';
|
$sql = 'UPDATE ' . MAIN_DB_PREFIX . $this->table_element . $mode.' SET';
|
||||||
$sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'" . $this->db->idate($this->doc_date) . "'" : 'null') . ',';
|
$sql .= ' doc_date = ' . (! isset($this->doc_date) || dol_strlen($this->doc_date) != 0 ? "'".$this->db->idate($this->doc_date)."'" : 'null') . ',';
|
||||||
$sql .= ' doc_type = ' . (isset($this->doc_type) ? "'" . $this->db->escape($this->doc_type) . "'" : "null") . ',';
|
$sql .= ' doc_type = ' . (isset($this->doc_type) ? "'" . $this->db->escape($this->doc_type) . "'" : "null") . ',';
|
||||||
$sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ',';
|
$sql .= ' doc_ref = ' . (isset($this->doc_ref) ? "'" . $this->db->escape($this->doc_ref) . "'" : "null") . ',';
|
||||||
$sql .= ' fk_doc = ' . (isset($this->fk_doc) ? $this->fk_doc : "null") . ',';
|
$sql .= ' fk_doc = ' . (isset($this->fk_doc) ? $this->fk_doc : "null") . ',';
|
||||||
@ -1688,7 +1688,7 @@ class BookKeeping extends CommonObject
|
|||||||
* @param string $piece_num Piece num
|
* @param string $piece_num Piece num
|
||||||
* @return int int <0 if KO, >0 if OK
|
* @return int int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
public function transformTransaction($direction=0,$piece_num='')
|
public function transformTransaction($direction = 0, $piece_num = '')
|
||||||
{
|
{
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
@ -1702,22 +1702,22 @@ class BookKeeping extends CommonObject
|
|||||||
if ($next_piecenum < 0) {
|
if ($next_piecenum < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.' (doc_date, doc_type,';
|
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . ' (doc_date, doc_type,';
|
||||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation)';
|
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num, date_creation)';
|
||||||
$sql .= ' SELECT doc_date, doc_type,';
|
$sql .= ' SELECT doc_date, doc_type,';
|
||||||
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
$sql .= ' doc_ref, fk_doc, fk_docdet, entity, thirdparty_code, subledger_account, subledger_label,';
|
||||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, '.$next_piecenum.', "'.$this->db->idate($now).'"';
|
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, ' . $next_piecenum . ", '".$this->db->idate($now)."'";
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $this->db->escape($piece_num);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $this->db->escape($piece_num);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
@ -1725,14 +1725,14 @@ class BookKeeping extends CommonObject
|
|||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
} elseif ($direction==1) {
|
} elseif ($direction==1) {
|
||||||
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $piece_num;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element.'_tmp (doc_date, doc_type,';
|
$sql = 'INSERT INTO ' . MAIN_DB_PREFIX . $this->table_element . '_tmp (doc_date, doc_type,';
|
||||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
|
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num)';
|
||||||
@ -1740,14 +1740,14 @@ class BookKeeping extends CommonObject
|
|||||||
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
$sql .= ' doc_ref, fk_doc, fk_docdet, thirdparty_code, subledger_account, subledger_label,';
|
||||||
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
$sql .= ' numero_compte, label_compte, label_operation, debit, credit,';
|
||||||
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
|
$sql .= ' montant, sens, fk_user_author, import_key, code_journal, journal_label, piece_num';
|
||||||
$sql .= ' FROM '.MAIN_DB_PREFIX . $this->table_element.' WHERE piece_num = '.$piece_num;
|
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element.' WHERE piece_num = ' . $piece_num;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
$this->errors[] = 'Error ' . $this->db->lasterror();
|
$this->errors[] = 'Error ' . $this->db->lasterror();
|
||||||
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR);
|
||||||
}
|
}
|
||||||
$sql = 'DELETE FROM '.MAIN_DB_PREFIX . $this->table_element.'_tmp WHERE piece_num = '.$piece_num;
|
$sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element . '_tmp WHERE piece_num = ' . $piece_num;
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if (! $resql) {
|
if (! $resql) {
|
||||||
$error ++;
|
$error ++;
|
||||||
|
|||||||
@ -88,18 +88,21 @@ if (preg_match('/api\/index\.php\/explorer/', $_SERVER["PHP_SELF"]) && ! empty($
|
|||||||
// index.php/xxx called by any REST client to run API
|
// index.php/xxx called by any REST client to run API
|
||||||
|
|
||||||
|
|
||||||
|
$reg=array();
|
||||||
preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
|
preg_match('/index\.php\/([^\/]+)(.*)$/', $_SERVER["PHP_SELF"], $reg);
|
||||||
// .../index.php/categories?sortfield=t.rowid&sortorder=ASC
|
// .../index.php/categories?sortfield=t.rowid&sortorder=ASC
|
||||||
|
|
||||||
|
|
||||||
// Set the flag to say to refresh (when we reload the explorer, production must be for API call only)
|
// When in production mode, a file api/temp/routes.php is created with the API available of current call.
|
||||||
$refreshcache=false;
|
// But, if we set $refreshcache to false, so it may have only one API in the routes.php file if we make a call for one API without
|
||||||
|
// using the explorer. And when we make another call for another API, the API is not into the api/temp/routes.php and a 404 is returned.
|
||||||
|
// So we force refresh to each call.
|
||||||
|
$refreshcache=(empty($conf->global->API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE) ? true : false);
|
||||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||||
{
|
{
|
||||||
$refreshcache=true;
|
$refreshcache=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$api = new DolibarrApi($db, '', $refreshcache);
|
$api = new DolibarrApi($db, '', $refreshcache);
|
||||||
//var_dump($api->r->apiVersionMap);
|
//var_dump($api->r->apiVersionMap);
|
||||||
|
|
||||||
@ -115,7 +118,7 @@ UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain',
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Call Explorer file for all APIs definitions
|
// Call Explorer file for all APIs definitions (this part is slow)
|
||||||
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
if (! empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root'))
|
||||||
{
|
{
|
||||||
// Scan all API files to load them
|
// Scan all API files to load them
|
||||||
@ -253,5 +256,6 @@ if (! empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' &&
|
|||||||
//var_dump($api->r->apiVersionMap);
|
//var_dump($api->r->apiVersionMap);
|
||||||
//exit;
|
//exit;
|
||||||
|
|
||||||
// Call API (we suppose we found it)
|
// 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.
|
||||||
$api->r->handle();
|
$api->r->handle();
|
||||||
|
|||||||
@ -43,7 +43,7 @@ $action=GETPOST('action','alpha');
|
|||||||
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'actioncommlist'; // To manage different context of search
|
$contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'actioncommlist'; // To manage different context of search
|
||||||
$resourceid=GETPOST("search_resourceid","int")?GETPOST("search_resourceid","int"):GETPOST("resourceid","int");
|
$resourceid=GETPOST("search_resourceid","int")?GETPOST("search_resourceid","int"):GETPOST("resourceid","int");
|
||||||
$pid=GETPOST("search_projectid",'int',3)?GETPOST("search_projectid",'int',3):GETPOST("projectid",'int',3);
|
$pid=GETPOST("search_projectid",'int',3)?GETPOST("search_projectid",'int',3):GETPOST("projectid",'int',3);
|
||||||
$status=GETPOST("search_status",'alpha')?GETPOST("search_status",'alpha'):GETPOST("status",'alpha');
|
$status=(GETPOST("search_status",'alpha') != '')?GETPOST("search_status",'alpha'):GETPOST("status",'alpha');
|
||||||
$type=GETPOST('search_type','alphanohtml')?GETPOST('search_type','alphanohtml'):GETPOST('type','alphanohtml');
|
$type=GETPOST('search_type','alphanohtml')?GETPOST('search_type','alphanohtml'):GETPOST('type','alphanohtml');
|
||||||
$optioncss = GETPOST('optioncss','alpha');
|
$optioncss = GETPOST('optioncss','alpha');
|
||||||
$year=GETPOST("year",'int');
|
$year=GETPOST("year",'int');
|
||||||
|
|||||||
@ -1189,32 +1189,32 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ids1='';$ids2='';
|
$ids1='';$ids2='';
|
||||||
if (count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',',array_keys($cases1[$h]));
|
if (is_array($cases1[$h]) && count($cases1[$h]) && array_keys($cases1[$h])) $ids1=join(',',array_keys($cases1[$h]));
|
||||||
if (count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',',array_keys($cases2[$h]));
|
if (is_array($cases2[$h]) && count($cases2[$h]) && array_keys($cases2[$h])) $ids2=join(',',array_keys($cases2[$h]));
|
||||||
|
|
||||||
if ($h == $begin_h) echo '<td class="'.$style.'_peruserleft cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
|
if ($h == $begin_h) echo '<td class="'.$style.'_peruserleft cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
|
||||||
else echo '<td class="'.$style.' cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
|
else echo '<td class="'.$style.' cal_peruser'.($var?' cal_impair '.$style.'_impair':'').'">';
|
||||||
if (count($cases1[$h]) == 1) // only 1 event
|
if (is_array($cases1[$h]) && count($cases1[$h]) == 1) // only 1 event
|
||||||
{
|
{
|
||||||
$output = array_slice($cases1[$h], 0, 1);
|
$output = array_slice($cases1[$h], 0, 1);
|
||||||
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
|
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
|
||||||
if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string'];
|
if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string'];
|
||||||
if ($output[0]['color']) $color1 = $output[0]['color'];
|
if ($output[0]['color']) $color1 = $output[0]['color'];
|
||||||
}
|
}
|
||||||
else if (count($cases1[$h]) > 1)
|
else if (is_array($cases1[$h]) && count($cases1[$h]) > 1)
|
||||||
{
|
{
|
||||||
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
|
$title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:'');
|
||||||
$color1='222222';
|
$color1='222222';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($cases2[$h]) == 1) // only 1 event
|
if (is_array($cases2[$h]) && count($cases2[$h]) == 1) // only 1 event
|
||||||
{
|
{
|
||||||
$output = array_slice($cases2[$h], 0, 1);
|
$output = array_slice($cases2[$h], 0, 1);
|
||||||
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
|
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
|
||||||
if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string'];
|
if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string'];
|
||||||
if ($output[0]['color']) $color2 = $output[0]['color'];
|
if ($output[0]['color']) $color2 = $output[0]['color'];
|
||||||
}
|
}
|
||||||
else if (count($cases2[$h]) > 1)
|
else if (is_array($cases2[$h]) && count($cases2[$h]) > 1)
|
||||||
{
|
{
|
||||||
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
|
$title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:'');
|
||||||
$color2='222222';
|
$color2='222222';
|
||||||
|
|||||||
@ -63,78 +63,86 @@ $object = new BonPrelevement($db,"");
|
|||||||
// Load object
|
// Load object
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
|
||||||
|
|
||||||
|
$hookmanager->initHooks(array('directdebitprevcard','globalcard'));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( $action == 'confirm_delete' )
|
$parameters = array('socid' => $socid);
|
||||||
|
$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
$res=$object->delete($user);
|
if ( $action == 'confirm_delete' )
|
||||||
if ($res > 0)
|
{
|
||||||
{
|
$res=$object->delete($user);
|
||||||
header("Location: index.php");
|
if ($res > 0)
|
||||||
exit;
|
{
|
||||||
}
|
header("Location: index.php");
|
||||||
}
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Seems to no be used and replaced with $action == 'infocredit
|
// Seems to no be used and replaced with $action == 'infocredit
|
||||||
if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes')
|
if ( $action == 'confirm_credite' && GETPOST('confirm','alpha') == 'yes')
|
||||||
{
|
{
|
||||||
$res=$object->set_credite();
|
$res=$object->set_credite();
|
||||||
if ($res >= 0)
|
if ($res >= 0)
|
||||||
{
|
{
|
||||||
header("Location: card.php?id=".$id);
|
header("Location: card.php?id=".$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
if ($action == 'infotrans' && $user->rights->prelevement->bons->send)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
|
if ($_FILES['userfile']['name'] && basename($_FILES['userfile']['name'],".ps") == $object->ref)
|
||||||
{
|
{
|
||||||
$dir = $conf->prelevement->dir_output.'/receipts';
|
$dir = $conf->prelevement->dir_output.'/receipts';
|
||||||
|
|
||||||
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
|
if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $dir . "/" . dol_unescapefile($_FILES['userfile']['name']),1) > 0)
|
||||||
{
|
{
|
||||||
$object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
$object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Location: card.php?id=".$id);
|
header("Location: card.php?id=".$id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dol_syslog("Fichier invalide",LOG_WARNING);
|
dol_syslog("Fichier invalide",LOG_WARNING);
|
||||||
$mesg='BadFile';
|
$mesg='BadFile';
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
$error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
$error = $object->set_infotrans($user, $dt, GETPOST('methode','alpha'));
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
header("Location: card.php?id=".$id."&error=$error");
|
header("Location: card.php?id=".$id."&error=$error");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set direct debit order to credited, create payment and close invoices
|
// Set direct debit order to credited, create payment and close invoices
|
||||||
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
|
if ($action == 'infocredit' && $user->rights->prelevement->bons->credit)
|
||||||
{
|
{
|
||||||
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
$dt = dol_mktime(12,0,0,GETPOST('remonth','int'),GETPOST('reday','int'),GETPOST('reyear','int'));
|
||||||
|
|
||||||
$error = $object->set_infocredit($user, $dt);
|
$error = $object->set_infocredit($user, $dt);
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
header("Location: card.php?id=".$id."&error=$error");
|
header("Location: card.php?id=".$id."&error=$error");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6289,7 +6289,7 @@ abstract class CommonObject
|
|||||||
* @param array $params Optional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan)
|
* @param array $params Optional parameters. Example: array('style'=>'class="oddeven"', 'colspan'=>$colspan)
|
||||||
* @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names)
|
* @param string $keysuffix Suffix string to add after name and id of field (can be used to avoid duplicate names)
|
||||||
* @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names)
|
* @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names)
|
||||||
* @param string $onetrtd All fields in same tr td
|
* @param string $onetrtd All fields in same tr td (TODO field not used ?)
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='', $onetrtd=0)
|
function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='', $onetrtd=0)
|
||||||
@ -6386,10 +6386,7 @@ abstract class CommonObject
|
|||||||
|
|
||||||
$out .= '<tr id="'.$html_id.'" '.$csstyle.' class="'.$class.$this->element.'_extras_'.$key.'" '.$domData.' >';
|
$out .= '<tr id="'.$html_id.'" '.$csstyle.' class="'.$class.$this->element.'_extras_'.$key.'" '.$domData.' >';
|
||||||
|
|
||||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0)
|
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
|
||||||
{
|
|
||||||
if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { $colspan='0'; }
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'selectlines') { $colspan++; }
|
if ($action == 'selectlines') { $colspan++; }
|
||||||
|
|
||||||
|
|||||||
@ -1556,6 +1556,7 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio
|
|||||||
$info = pathinfo($destfile);
|
$info = pathinfo($destfile);
|
||||||
|
|
||||||
$destfile = dol_sanitizeFileName($info['filename'].($info['extension']!='' ? ('.'.strtolower($info['extension'])) : ''));
|
$destfile = dol_sanitizeFileName($info['filename'].($info['extension']!='' ? ('.'.strtolower($info['extension'])) : ''));
|
||||||
|
|
||||||
// We apply dol_string_nohtmltag also to clean file names (this remove duplicate spaces) because
|
// We apply dol_string_nohtmltag also to clean file names (this remove duplicate spaces) because
|
||||||
// this function is also applied when we make try to download file (by the GETPOST(filename, 'alphanohtml') call).
|
// this function is also applied when we make try to download file (by the GETPOST(filename, 'alphanohtml') call).
|
||||||
$destfile = dol_string_nohtmltag($destfile);
|
$destfile = dol_string_nohtmltag($destfile);
|
||||||
|
|||||||
@ -414,7 +414,11 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make substitutions into odt of thirdparty
|
// Make substitutions into odt of thirdparty
|
||||||
$tmparray=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
|
if ($socobject->element == 'contact') {
|
||||||
|
$tmparray = $this->get_substitutionarray_contact($socobject, $outputlangs);
|
||||||
|
} else {
|
||||||
|
$tmparray = $this->get_substitutionarray_thirdparty($socobject, $outputlangs);
|
||||||
|
}
|
||||||
foreach($tmparray as $key=>$value)
|
foreach($tmparray as $key=>$value)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -29,6 +29,7 @@
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/expedition/modules_expedition.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1120,11 +1120,10 @@ class ExpenseReport extends CommonObject
|
|||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
if (!$notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('EXPENSE_REPORT_VALIDATE',$fuser);
|
$result=$this->call_trigger('EXPENSE_REPORT_VALIDATE', $fuser);
|
||||||
|
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -1148,7 +1147,7 @@ class ExpenseReport extends CommonObject
|
|||||||
$dirdest = $conf->expensereport->dir_output.'/'.$newref;
|
$dirdest = $conf->expensereport->dir_output.'/'.$newref;
|
||||||
if (file_exists($dirsource))
|
if (file_exists($dirsource))
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::valid() rename dir ".$dirsource." into ".$dirdest);
|
dol_syslog(get_class($this)."::setValidate() rename dir ".$dirsource." into ".$dirdest);
|
||||||
|
|
||||||
if (@rename($dirsource, $dirdest))
|
if (@rename($dirsource, $dirdest))
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user