Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
3fa7cdf17f
@ -183,7 +183,7 @@ $langs->load("cashdesk");
|
||||
else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("Cash").'" onclick="javascript: verifClic(\'ESP\');" />';
|
||||
print '</div>';
|
||||
print '<div class="inline-block" style="margin: 6px;">';
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
|
||||
@ -191,7 +191,7 @@ $langs->load("cashdesk");
|
||||
else print '<input class="button bouton_mode_reglement" type="submit" name="btnModeReglement" value="'.$langs->trans("CreditCard").'" onclick="javascript: verifClic(\'CB\');" />';
|
||||
print '</div>';
|
||||
print '<div class="inline-block" style="margin: 6px;">';
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0)
|
||||
if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
print '<input class="bouton_mode_reglement_disabled" type="button" name="btnModeReglement" value="'.$langs->trans("CheckBank").'" title="'.dol_escape_htmltag($langs->trans("ErrorModuleSetupNotComplete")).'" />';
|
||||
|
||||
@ -753,7 +753,7 @@ class CMailFile
|
||||
$domainName = $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
|
||||
$selector = $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
|
||||
$signer = new Swift_Signers_DKIMSigner($privateKey, $domainName, $selector);
|
||||
$this->message->attachSigner($signer);
|
||||
$this->message->attachSigner($signer->ignoreHeader('Return-Path'));
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_MAIL_DEBUG)) {
|
||||
|
||||
@ -591,6 +591,7 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
if (!empty($updatekeys)) {
|
||||
// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
|
||||
|
||||
if (empty($lastinsertid)) {
|
||||
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||
|
||||
@ -626,6 +627,34 @@ class ImportCsv extends ModeleImports
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
// We have a last INSERT ID. Check if we have a row referencing this foreign key.
|
||||
// This is required when updating table with some extrafields. When inserting a record in parent table, we can make
|
||||
// a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record
|
||||
// may already exists. So we rescan the extrafield table to be know if record exists or not for the rowid.
|
||||
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||
|
||||
if(empty($keyfield)) $keyfield = 'rowid';
|
||||
$sqlSelect .= ' WHERE '.$keyfield.' = '.$lastinsertid;
|
||||
|
||||
$resql=$this->db->query($sqlSelect);
|
||||
if($resql) {
|
||||
$res = $this->db->fetch_object($resql);
|
||||
if($resql->num_rows == 1) {
|
||||
// We have a row referencing this last foreign key, continue with UPDATE.
|
||||
} else {
|
||||
// No record found referencing this last foreign key,
|
||||
// force $lastinsertid to 0 so we INSERT below.
|
||||
$lastinsertid = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print 'E';
|
||||
$this->errors[$error]['lib']=$this->db->lasterror();
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($lastinsertid)) {
|
||||
|
||||
@ -651,6 +651,34 @@ class ImportXlsx extends ModeleImports
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
// We have a last INSERT ID. Check if we have a row referencing this foreign key.
|
||||
// This is required when updating table with some extrafields. When inserting a record in parent table, we can make
|
||||
// a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record
|
||||
// may already exists. So we rescan the extrafield table to be know if record exists or not for the rowid.
|
||||
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||
|
||||
if(empty($keyfield)) $keyfield = 'rowid';
|
||||
$sqlSelect .= ' WHERE '.$keyfield.' = '.$lastinsertid;
|
||||
|
||||
$resql=$this->db->query($sqlSelect);
|
||||
if($resql) {
|
||||
$res = $this->db->fetch_object($resql);
|
||||
if($resql->num_rows == 1) {
|
||||
// We have a row referencing this last foreign key, continue with UPDATE.
|
||||
} else {
|
||||
// No record found referencing this last foreign key,
|
||||
// force $lastinsertid to 0 so we INSERT below.
|
||||
$lastinsertid = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print 'E';
|
||||
$this->errors[$error]['lib']=$this->db->lasterror();
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($lastinsertid)) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user