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

Conflicts:
	htdocs/compta/paiement/card.php
	htdocs/compta/paiement/class/paiement.class.php
	htdocs/public/members/new.php
This commit is contained in:
Laurent Destailleur 2021-04-27 02:07:48 +02:00
commit d6cdfcdd8c
9 changed files with 85 additions and 26 deletions

View File

@ -557,7 +557,7 @@ class AccountancyExport
$Tab['signe_montant'] = '+'; $Tab['signe_montant'] = '+';
// The amount must be in centimes without decimal points. // The amount must be in centimes without decimal points.
$Tab['montant'] = str_pad(abs(($data->debit - $abs->credit) * 100), 12, '0', STR_PAD_LEFT); $Tab['montant'] = str_pad(abs(($data->debit - $data->credit) * 100), 12, '0', STR_PAD_LEFT);
$Tab['contrepartie'] = str_repeat(' ', 8); $Tab['contrepartie'] = str_repeat(' ', 8);
// Force date format : %d%m%y // Force date format : %d%m%y

View File

@ -189,7 +189,7 @@ foreach ($dirmodels as $reldir) {
if ($conf->global->PAYMENT_ADDON == $file || $conf->global->PAYMENT_ADDON.'.php' == $file) { if ($conf->global->PAYMENT_ADDON == $file || $conf->global->PAYMENT_ADDON.'.php' == $file) {
print img_picto($langs->trans("Activated"), 'switch_on'); print img_picto($langs->trans("Activated"), 'switch_on');
} else { } else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmo&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>'; print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&value='.preg_replace('/\.php$/', '', $file).'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
} }
print '</td>'; print '</td>';

View File

@ -616,6 +616,10 @@ class AdvanceTargetingMailing extends CommonObject
if ($arrayquery['options_'.$key] != '') { if ($arrayquery['options_'.$key] != '') {
$sqlwhere[] = " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")"; $sqlwhere[] = " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")";
} }
} elseif ($extrafields->attributes[$elementtype]['type'][$key] == 'link') {
if ($arrayquery['options_'.$key] > 0) {
$sqlwhere[]= " (te.".$key." = ".((int) $arrayquery['options_'.$key]).")";
}
} else { } else {
if (is_array($arrayquery['options_'.$key])) { if (is_array($arrayquery['options_'.$key])) {
$sqlwhere[] = " (te.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery['options_'.$key])."'", 1)."))"; $sqlwhere[] = " (te.".$key." IN (".$this->db->sanitize("'".implode("','", $arrayquery['options_'.$key])."'", 1)."))";
@ -642,7 +646,6 @@ class AdvanceTargetingMailing extends CommonObject
if ($num) { if ($num) {
while ($i < $num) { while ($i < $num) {
$obj = $this->db->fetch_object($resql); $obj = $this->db->fetch_object($resql);
$this->thirdparty_lines[$i] = $obj->rowid; $this->thirdparty_lines[$i] = $obj->rowid;
$i++; $i++;

View File

@ -110,27 +110,71 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $user->rights->facture
$db->commit(); $db->commit();
// Loop on each invoice linked to this payment to rebuild PDF // Loop on each invoice linked to this payment to rebuild PDF
$factures = array(); if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
foreach ($factures as $id) { $outputlangs = $langs;
$fac = new Facture($db); if (GETPOST('lang_id', 'aZ09')) {
$fac->fetch($id); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang(GETPOST('lang_id', 'aZ09'));
}
$outputlangs = $langs; $hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
if (!empty($_REQUEST['lang_id'])) { $hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
$outputlangs = new Translate("", $conf); $hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
} $sql = 'SELECT f.rowid as facid';
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $sql .= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
$fac->generateDocument($fac->model_pdf, $outputlangs); $sql .= ' WHERE pf.fk_facture = f.rowid';
} $sql .= ' AND f.fk_soc = s.rowid';
$sql .= ' AND f.entity IN ('.getEntity('invoice').')';
$sql .= ' AND pf.fk_paiement = '.$object->id;
$resql = $db->query($sql);
if ($resql)
{
$i = 0;
$num = $db->num_rows($resql);
if ($num > 0)
{
while ($i < $num)
{
$objp = $db->fetch_object($resql);
$invoice = new Facture($db);
if ($invoice->fetch($objp->facid) <= 0) {
$errors++;
setEventMessages($invoice->error, $invoice->errors, 'errors');
break;
}
if ($invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref) < 0) {
$errors++;
setEventMessages($invoice->error, $invoice->errors, 'errors');
break;
}
$i++;
}
}
$db->free($resql);
}
else
{
$errors++;
setEventMessages($db->error, $db->errors, 'errors');
}
} }
header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); if (! $errors) {
exit; header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
exit;
}
} else { } else {
$db->rollback();
$langs->load("errors"); $langs->load("errors");
setEventMessages($object->error, $object->errors, 'errors'); setEventMessages($object->error, $object->errors, 'errors');
$db->rollback();
} }
} }

View File

@ -413,8 +413,15 @@ class Paiement extends CommonObject
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$hidedetails = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0;
$hidedesc = ! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0;
$hideref = !empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0;
$ret = $invoice->fetch($facid); // Reload to get new records $ret = $invoice->fetch($facid); // Reload to get new records
$result = $invoice->generateDocument($invoice->model_pdf, $outputlangs);
$result = $invoice->generateDocument($invoice->model_pdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0) { if ($result < 0) {
setEventMessages($invoice->error, $invoice->errors, 'errors'); setEventMessages($invoice->error, $invoice->errors, 'errors');
$error++; $error++;

View File

@ -297,7 +297,7 @@ class FormFile
$out .= "\n</div><!-- End form link new url -->\n"; $out .= "\n</div><!-- End form link new url -->\n";
} }
$parameters = array('socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url'=>$url, 'perm'=>$perm); $parameters = array('socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url'=>$url, 'perm'=>$perm, 'options'=>$options);
$res = $hookmanager->executeHooks('formattachOptions', $parameters, $object); $res = $hookmanager->executeHooks('formattachOptions', $parameters, $object);
if (empty($res)) { if (empty($res)) {
print '<div class="'.($usewithoutform ? 'inline-block valignmiddle' : 'attacharea attacharea'.$htmlname).'">'; print '<div class="'.($usewithoutform ? 'inline-block valignmiddle' : 'attacharea attacharea'.$htmlname).'">';

View File

@ -15,4 +15,6 @@
/.buildpath /.buildpath
/.project /.project
# Other # Other
*.back *.back
/.editorconfig
/.gitattributes

View File

@ -222,10 +222,13 @@ if (empty($reshook) && $action == 'add') {
$error++; $error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n"; $errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
} }
if (GETPOST('email') && !isValidEmail(GETPOST('email'))) { if (!empty($conf->global->ADHERENT_MAIL_REQUIRED) && empty(GETPOST('email'))) {
$error++; $error++;
$langs->load("errors"); $errmsg .= $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Email'))."<br>\n";
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST('email'))."<br>\n"; } elseif (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
$langs->load('errors');
$error++;
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
} }
$birthday = dol_mktime(GETPOST("birthhour", 'int'), GETPOST("birthmin", 'int'), GETPOST("birthsec", 'int'), GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int')); $birthday = dol_mktime(GETPOST("birthhour", 'int'), GETPOST("birthmin", 'int'), GETPOST("birthsec", 'int'), GETPOST("birthmonth", 'int'), GETPOST("birthday", 'int'), GETPOST("birthyear", 'int'));
if (GETPOST("birthmonth") && empty($birthday)) { if (GETPOST("birthmonth") && empty($birthday)) {
@ -630,7 +633,7 @@ if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
print '</td></tr>'; print '</td></tr>';
} }
// EMail // EMail
print '<tr><td>'.$langs->trans("Email").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n"; print '<tr><td>'.$langs->trans("Email").($conf->global->ADHERENT_MAIL_REQUIRED ? ' <span style="color:red;">*</span>' : '').'</td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
// Login // Login
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
print '<tr><td>'.$langs->trans("Login").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="login" maxlength="50" class="minwidth100"value="'.dol_escape_htmltag(GETPOST('login')).'"></td></tr>'."\n"; print '<tr><td>'.$langs->trans("Login").' <FONT COLOR="red">*</FONT></td><td><input type="text" name="login" maxlength="50" class="minwidth100"value="'.dol_escape_htmltag(GETPOST('login')).'"></td></tr>'."\n";

View File

@ -536,7 +536,7 @@ class ProductCombination
$new_price += $variation_price; $new_price += $variation_price;
} }
$child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq); $child->updatePrice($new_price, $new_type, $user, $new_vat, $new_min_price, $i, $new_npr, $new_psq, 0, array(), $parent->default_vat_code);
} }
} }
} else { } else {