Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
c673d283
Commit
c673d283
authored
8 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix script to send emailings
parent
ad095d7f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
+1
-1
1 addition, 1 deletion
...ore/triggers/interface_50_modAgenda_ActionsAuto.class.php
scripts/emailings/mailing-send.php
+31
-10
31 additions, 10 deletions
scripts/emailings/mailing-send.php
with
32 additions
and
11 deletions
htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php
+
1
−
1
View file @
c673d283
...
...
@@ -48,7 +48,7 @@ class InterfaceActionsAuto extends DolibarrTriggers
* $object->actionmsg (note, long text)
* $object->actionmsg2 (label, short text)
* $object->sendtoid (id of contact or array of ids)
* $object->socid
* $object->socid
(id of thirdparty)
* $object->fk_project
* $object->fk_element
* $object->elementtype
...
...
This diff is collapsed.
Click to expand it.
scripts/emailings/mailing-send.php
+
31
−
10
View file @
c673d283
...
...
@@ -41,11 +41,12 @@ if (! isset($argv[1]) || ! $argv[1]) {
exit
(
-
1
);
}
$id
=
$argv
[
1
];
if
(
!
isset
(
$argv
[
2
])
||
!
empty
(
$argv
[
2
]))
$login
=
$argv
[
2
];
if
(
isset
(
$argv
[
2
])
||
!
empty
(
$argv
[
2
]))
$login
=
$argv
[
2
];
else
$login
=
''
;
require_once
(
$path
.
"../../htdocs/master.inc.php"
);
require_once
(
DOL_DOCUMENT_ROOT
.
"/core/class/CMailFile.class.php"
);
require_once
(
DOL_DOCUMENT_ROOT
.
"/comm/mailing/class/mailing.class.php"
);
// Global variables
...
...
@@ -70,9 +71,8 @@ $user = new User($db);
// for signature, we use user send as parameter
if
(
!
empty
(
$login
))
$user
->
fetch
(
''
,
$login
);
// We get list of emailing to process
$sql
=
"SELECT m.rowid, m.titre, m.sujet, m.body,"
;
$sql
.
=
" m.email_from, m.email_replyto, m.email_errorsto"
;
// We get list of emailing id to process
$sql
=
"SELECT m.rowid"
;
$sql
.
=
" FROM "
.
MAIN_DB_PREFIX
.
"mailing as m"
;
$sql
.
=
" WHERE m.statut IN (1,2)"
;
if
(
$id
!=
'all'
)
...
...
@@ -96,12 +96,15 @@ if ($resql)
dol_syslog
(
"Process mailing with id "
.
$obj
->
rowid
);
print
"Process mailing with id "
.
$obj
->
rowid
.
"
\n
"
;
$id
=
$obj
->
rowid
;
$subject
=
$obj
->
sujet
;
$message
=
$obj
->
body
;
$from
=
$obj
->
email_from
;
$replyto
=
$obj
->
email_replyto
;
$errorsto
=
$obj
->
email_errorsto
;
$emailing
=
new
Mailing
(
$db
);
$emailing
->
fetch
(
$obj
->
rowid
);
$id
=
$emailing
->
id
;
$subject
=
$emailing
->
sujet
;
$message
=
$emailing
->
body
;
$from
=
$emailing
->
email_from
;
$replyto
=
$emailing
->
email_replyto
;
$errorsto
=
$emailing
->
email_errorsto
;
// Le message est-il en html
$msgishtml
=-
1
;
// Unknown by default
if
(
preg_match
(
'/[\s\t]*<html>/i'
,
$message
))
$msgishtml
=
1
;
...
...
@@ -232,6 +235,24 @@ if ($resql)
dol_syslog
(
"ok for emailing id "
.
$id
.
" #"
.
$i
.
(
$mail
->
error
?
' - '
.
$mail
->
error
:
''
),
LOG_DEBUG
);
// Note: If emailing is 100 000 targets, 100 000 entries are added, so we don't enter events for each target here
// We must union table llx_mailing_taget for event tab OR enter 1 event with a special table link (id of email in event)
// Run trigger
/*
if ($obj2->source_type == 'contact')
{
$emailing->sendtoid = $obj2->source_id;
}
if ($obj2->source_type == 'thirdparty')
{
$emailing->socid = $obj2->source_id;
}
// Call trigger
$result=$emailing->call_trigger('EMAILING_SENTBYMAIL',$user);
if ($result < 0) $error++;
// End call triggers
*/
$sqlok
=
"UPDATE "
.
MAIN_DB_PREFIX
.
"mailing_cibles"
;
$sqlok
.
=
" SET statut=1, date_envoi='"
.
$db
->
idate
(
$now
)
.
"' WHERE rowid="
.
$obj2
->
rowid
;
$resqlok
=
$db
->
query
(
$sqlok
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment