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

Conflicts:
	.travis.yml
	htdocs/ticket/class/actions_ticket.class.php
This commit is contained in:
Laurent Destailleur 2021-06-17 22:06:26 +02:00
commit ceaa2a9c5e
2 changed files with 31 additions and 4 deletions

View File

@ -493,22 +493,44 @@ class Mailing extends CommonObject
/**
* Delete emailing
*
* @param int $rowid id du mailing a supprimer
* @return int 1 en cas de succes
* @param int $rowid Id if emailing to delete
* @param int $notrigger Disable triggers
* @return int >0 if OK, <0 if KO
*/
public function delete($rowid)
public function delete($rowid, $notrigger = 0)
{
global $user;
$this->db->begin();
$sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing";
$sql .= " WHERE rowid = ".((int) $rowid);
dol_syslog("Mailing::delete", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
return $this->delete_targets();
$res = $this->delete_targets();
if ($res <= 0) {
$this->db->rollback();
$this->error = $this->db->lasterror();
return -1;
}
} else {
$this->db->rollback();
$this->error = $this->db->lasterror();
return -1;
}
if (!$notrigger) {
$result = $this->call_trigger('MAILING_DELETE', $user);
if ($result < 0) {
$this->db->rollback();
return -1;
}
}
$this->db->commit();
return 1;
}
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps

View File

@ -394,6 +394,11 @@ if (!empty($conf->variants->eabled) && empty($conf->global->VARIANT_ALLOW_STOCK_
if ($fk_supplier > 0) {
$sql .= ' AND EXISTS (SELECT pfp.rowid FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp WHERE pfp.fk_product = p.rowid AND pfp.fk_soc = '.((int) $fk_supplier).' AND pfp.entity IN ('.getEntity('product_fournisseur_price').'))';
}
// Add where from hooks
$parameters = array();
$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook
$sql .= $hookmanager->resPrint;
$sql .= ' GROUP BY p.rowid, p.ref, p.label, p.description, p.price';
$sql .= ', p.price_ttc, p.price_base_type,p.fk_product_type, p.tms';
$sql .= ', p.duration, p.tobuy';