2
0
forked from Wavyzz/dolibarr

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

Conflicts:
	htdocs/admin/emailcollector_card.php
This commit is contained in:
Laurent Destailleur
2020-12-23 11:59:14 +01:00
10 changed files with 53 additions and 38 deletions

View File

@@ -50,6 +50,9 @@ jobs:
- if: type = push AND branch = develop
php: nightly
env: DB=mysql
- if: type = push AND branch = 13.0
php: nightly
env: DB=mysql
notifications:
email:

View File

@@ -135,12 +135,13 @@ if ($action == 'deletefilter')
{
$emailcollectorfilter = new EmailCollectorFilter($db);
$emailcollectorfilter->fetch(GETPOST('filterid', 'int'));
$result = $emailcollectorfilter->delete($user);
if ($result > 0)
{
$object->fetchFilters();
} else {
setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors');
if ($emailcollectorfilter->id > 0) {
$result = $emailcollectorfilter->delete($user);
if ($result > 0) {
$object->fetchFilters();
} else {
setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors');
}
}
}
@@ -153,6 +154,11 @@ if (GETPOST('addoperation', 'alpha'))
$emailcollectoroperation->status = 1;
$emailcollectoroperation->position = 50;
if ($emailcollectoroperation->type == '-1') {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Operation")), null, 'errors');
}
if (in_array($emailcollectoroperation->type, array('loadthirdparty', 'loadandcreatethirdparty'))
&& empty($emailcollectoroperation->actionparam)) {
$error++;
@@ -200,12 +206,13 @@ if ($action == 'deleteoperation')
{
$emailcollectoroperation = new EmailCollectorAction($db);
$emailcollectoroperation->fetch(GETPOST('operationid', 'int'));
$result = $emailcollectoroperation->delete($user);
if ($result > 0)
{
$object->fetchActions();
} else {
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
if ($emailcollectoroperation->id > 0) {
$result = $emailcollectoroperation->delete($user);
if ($result > 0) {
$object->fetchActions();
} else {
setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors');
}
}
}

View File

@@ -3159,8 +3159,8 @@ class Commande extends CommonOrder
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
$this->line->remise_percent = $remise_percent;
$this->line->subprice = $subprice;
$this->line->info_bits = $info_bits;

View File

@@ -3136,8 +3136,8 @@ class Facture extends CommonInvoice
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = ($total_localtax1 ? $localtaxes_type[1] : 0);
$this->line->localtax2_tx = ($total_localtax2 ? $localtaxes_type[3] : 0);
$this->line->localtax1_type = isset($localtaxes_type[0]) ? $localtaxes_type[0] : '';
$this->line->localtax2_type = isset($localtaxes_type[2]) ? $localtaxes_type[2] : '';
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_ttc = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ttc) : $total_ttc); // For credit note and if qty is negative, total is negative
@@ -3375,8 +3375,8 @@ class Facture extends CommonInvoice
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
$this->line->remise_percent = $remise_percent;
$this->line->subprice = ($this->type == self::TYPE_CREDIT_NOTE ?-abs($pu_ht) : $pu_ht); // For credit note, unit price always negative, always positive otherwise

View File

@@ -56,7 +56,7 @@ class EmailCollector extends CommonObject
/**
* @var string String with name of icon for emailcollector. Must be the part after the 'object_' into object_emailcollector.png
*/
public $picto = 'generic';
public $picto = 'email';
/**
* @var string Field with ID of parent key if this field has a parent

View File

@@ -1714,8 +1714,8 @@ class CommandeFournisseur extends CommonOrder
$multicurrency_total_ttc = $tabprice[18];
$pu_ht_devise = $tabprice[19];
$localtax1_type = $localtaxes_type[0];
$localtax2_type = $localtaxes_type[2];
$localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
$rangmax = $this->line_max();
$rang = $rangmax + 1;
@@ -1734,8 +1734,8 @@ class CommandeFournisseur extends CommonOrder
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = ($total_localtax1 ? $localtaxes_type[1] : 0);
$this->line->localtax2_tx = ($total_localtax2 ? $localtaxes_type[3] : 0);
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->localtax1_type = $localtax1_type;
$this->line->localtax2_type = $localtax2_type;
$this->line->fk_product = $fk_product;
$this->line->product_type = $product_type;
$this->line->remise_percent = $remise_percent;
@@ -2594,8 +2594,8 @@ class CommandeFournisseur extends CommonOrder
$multicurrency_total_ttc = $tabprice[18];
$pu_ht_devise = $tabprice[19];
$localtax1_type = $localtaxes_type[0];
$localtax2_type = $localtaxes_type[2];
$localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
//Fetch current line from the database and then clone the object and set it in $oldline property
$this->line = new CommandeFournisseurLigne($this->db);
@@ -2633,8 +2633,8 @@ class CommandeFournisseur extends CommonOrder
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = $txlocaltax1;
$this->line->localtax2_tx = $txlocaltax2;
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
$this->line->remise_percent = $remise_percent;
$this->line->subprice = $pu_ht;
$this->line->rang = $this->rang;

View File

@@ -1765,8 +1765,8 @@ class FactureFournisseur extends CommonInvoice
$this->line->tva_tx = $txtva;
$this->line->localtax1_tx = ($total_localtax1 ? $localtaxes_type[1] : 0);
$this->line->localtax2_tx = ($total_localtax2 ? $localtaxes_type[3] : 0);
$this->line->localtax1_type = $localtaxes_type[0];
$this->line->localtax2_type = $localtaxes_type[2];
$this->line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$this->line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
$this->line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht); // For credit note and if qty is negative, total is negative
$this->line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_tva) : $total_tva);
@@ -1952,8 +1952,8 @@ class FactureFournisseur extends CommonInvoice
$line->tva_tx = $vatrate;
$line->localtax1_tx = $txlocaltax1;
$line->localtax2_tx = $txlocaltax2;
$line->localtax1_type = $localtaxes_type[0];
$line->localtax2_type = $localtaxes_type[2];
$line->localtax1_type = empty($localtaxes_type[0]) ? '' : $localtaxes_type[0];
$line->localtax2_type = empty($localtaxes_type[2]) ? '' : $localtaxes_type[2];
$line->total_ht = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_ht) : $total_ht);
$line->total_tva = (($this->type == self::TYPE_CREDIT_NOTE || $qty < 0) ?-abs($total_tva) : $total_tva);
$line->total_localtax1 = $total_localtax1;

View File

@@ -1989,8 +1989,8 @@ EmailcollectorOperationsDesc=Operations are executed from top to bottom order
MaxEmailCollectPerCollect=Max number of emails collected per collect
CollectNow=Collect now
ConfirmCloneEmailCollector=Are you sure you want to clone the Email collector %s ?
DateLastCollectResult=Date latest collect tried
DateLastcollectResultOk=Date latest collect successfull
DateLastCollectResult=Date of latest collect try
DateLastcollectResultOk=Date of latest collect success
LastResult=Latest result
EmailCollectorConfirmCollectTitle=Email collect confirmation
EmailCollectorConfirmCollect=Do you want to run the collection for this collector now ?

View File

@@ -417,7 +417,7 @@ if ((!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck) && !empty($conf->gl
// Check all cases that need a token (all POST actions, all actions and mass actions on pages with CSRFCHECK_WITH_TOKEN set, all sensitive GET actions)
if ($_SERVER['REQUEST_METHOD'] == 'POST' ||
((GETPOSTISSET('action') || GETPOSTISSET('massaction')) && defined('CSRFCHECK_WITH_TOKEN')) ||
in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deleteprof', 'deletepayment', 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_reject_check')))
in_array(GETPOST('action', 'aZ09'), array('add', 'addtimespent', 'update', 'install', 'delete', 'deletefilter', 'deleteoperation', 'deleteprof', 'deletepayment', 'confirm_create_user', 'confirm_create_thirdparty', 'confirm_reject_check')))
{
if (!GETPOSTISSET('token')) {
if (GETPOST('uploadform', 'int')) {

View File

@@ -44,7 +44,7 @@ if ($object->fetch($id) < 1) {
if ($cancel) $action = '';
if ($action) {
if ($action == 'edit') {
if ($action == 'update') {
$object->ref = $ref;
$object->label = $label;
@@ -55,7 +55,7 @@ if ($action) {
header('Location: '.dol_buildpath('/variants/card.php?id='.$id, 2));
exit();
}
} elseif ($action == 'update') {
} elseif ($action == 'update_value') {
if ($objectval->fetch($valueid) > 0) {
$objectval->ref = $ref;
$objectval->value = GETPOST('value', 'alpha');
@@ -139,7 +139,12 @@ $h++;
print dol_get_fiche_head($head, 'variant', $langs->trans('ProductAttributeName'), -1, 'generic');
if ($action == 'edit') {
print '<form method="POST">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="valueid" value="'.$valueid.'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
}
@@ -232,7 +237,7 @@ if ($action == 'edit') {
if ($action == 'edit_value') {
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="action" value="update_value">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="valueid" value="'.$valueid.'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';