Skip to content
Snippets Groups Projects
Verified Commit 1a2dba24 authored by Damien's avatar Damien
Browse files

FEAT #7504 Mailing first res

parent 9b306753
No related branches found
No related tags found
No related merge requests found
......@@ -321,6 +321,15 @@ if (isset($_POST['add']) && $_POST['add']) {
foreach ($contactsForMailing as $key => $contactForMailing) {
if ($key == 0) {
$resId = $_SESSION['doc_id'];
\Resource\models\ResModel::updateExt([
'set' => [
'is_multicontacts' => 'N',
'address_id' => $contactForMailing['address_id'],
'exp_contact_id' => $contactForMailing['contact_id']
],
'where' => ['res_id = ?'],
'data' => $resId
]);
} else {
$resId = \Resource\controllers\ResController::duplicateForMailing([
'resId' => $_SESSION['doc_id'],
......@@ -388,6 +397,11 @@ if (isset($_POST['add']) && $_POST['add']) {
$_SESSION['config']['databasetype']
);
}
\SrcCore\models\DatabaseModel::delete([
'table' => 'contacts_res',
'where' => ['res_id = ?'],
'data' => [$_SESSION['doc_id']]
]);
} else {
//SAVE META DATAS IN DB
$id = $resAttach->load_into_db(
......
......@@ -148,13 +148,13 @@ abstract class ResModelAbstract
return true;
}
public static function updateExt(array $aArgs)
public static function update(array $aArgs)
{
ValidatorModel::notEmpty($aArgs, ['set', 'where', 'data']);
ValidatorModel::arrayType($aArgs, ['set', 'where', 'data']);
DatabaseModel::update([
'table' => 'mlb_coll_ext',
'table' => 'res_letterbox',
'set' => $aArgs['set'],
'where' => $aArgs['where'],
'data' => $aArgs['data']
......@@ -163,13 +163,13 @@ abstract class ResModelAbstract
return true;
}
public static function update(array $aArgs)
public static function updateExt(array $aArgs)
{
ValidatorModel::notEmpty($aArgs, ['set', 'where', 'data']);
ValidatorModel::arrayType($aArgs, ['set', 'where', 'data']);
DatabaseModel::update([
'table' => 'res_letterbox',
'table' => 'mlb_coll_ext',
'set' => $aArgs['set'],
'where' => $aArgs['where'],
'data' => $aArgs['data']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment