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
bc401a86
Commit
bc401a86
authored
15 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Better error management
parent
cb39e929
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/emailings/mailing-send.php
+11
-8
11 additions, 8 deletions
scripts/emailings/mailing-send.php
with
11 additions
and
8 deletions
scripts/emailings/mailing-send.php
+
11
−
8
View file @
bc401a86
...
...
@@ -34,12 +34,12 @@ $path=preg_replace('@[\\\/]+$@','',$path).'/';
// Test if batch mode
if
(
substr
(
$sapi_type
,
0
,
3
)
==
'cgi'
)
{
echo
"Error: You ar using
r
PH for CGI. To execute "
.
$script_file
.
" from command line, you must use PHP for CLI mode.
\n
"
;
echo
"Error: You ar
e
using PH
P
for CGI. To execute "
.
$script_file
.
" from command line, you must use PHP for CLI mode.
\n
"
;
exit
;
}
if
(
!
isset
(
$argv
[
1
])
||
!
$argv
[
1
])
{
print
"Usage:
mailing-send.php
ID_MAILING
\n
"
;
print
"Usage:
"
.
$script_file
.
"
ID_MAILING
\n
"
;
exit
;
}
$id
=
$argv
[
1
];
...
...
@@ -69,7 +69,7 @@ if ($resql)
{
$obj
=
$db
->
fetch_object
(
$resql
);
dol_syslog
(
"mailing
-send: mailing
"
.
$id
);
dol_syslog
(
"mailing "
.
$id
);
$id
=
$obj
->
rowid
;
$subject
=
$obj
->
sujet
;
...
...
@@ -84,6 +84,10 @@ if ($resql)
$i
++
;
}
else
{
dol_syslog
(
"Error emailing with id "
.
$id
.
" not found"
,
LOG_ERR
);
}
}
...
...
@@ -102,7 +106,7 @@ if ($resql)
if
(
$num
)
{
dol_syslog
(
"
mailing-send:
nb of targets = "
.
$num
,
LOG_DEBUG
);
dol_syslog
(
"nb of targets = "
.
$num
,
LOG_DEBUG
);
// Positionne date debut envoi
$sql
=
"UPDATE "
.
MAIN_DB_PREFIX
.
"mailing SET date_envoi=SYSDATE() WHERE rowid="
.
$id
;
...
...
@@ -172,7 +176,7 @@ if ($resql)
// Mail successful
$nbok
++
;
dol_syslog
(
"
mailing-send:
ok for #"
.
$i
.
(
$mail
->
error
?
' - '
.
$mail
->
error
:
''
),
LOG_DEBUG
);
dol_syslog
(
"ok for #"
.
$i
.
(
$mail
->
error
?
' - '
.
$mail
->
error
:
''
),
LOG_DEBUG
);
$sql
=
"UPDATE "
.
MAIN_DB_PREFIX
.
"mailing_cibles"
;
$sql
.
=
" SET statut=1, date_envoi=SYSDATE() WHERE rowid="
.
$obj
->
rowid
;
...
...
@@ -187,7 +191,7 @@ if ($resql)
// Mail failed
$nbko
++
;
dol_syslog
(
"
mailing-send:
error for #"
.
$i
.
(
$mail
->
error
?
' - '
.
$mail
->
error
:
''
),
LOG_DEBUG
);
dol_syslog
(
"error for #"
.
$i
.
(
$mail
->
error
?
' - '
.
$mail
->
error
:
''
),
LOG_DEBUG
);
$sql
=
"UPDATE "
.
MAIN_DB_PREFIX
.
"mailing_cibles"
;
$sql
.
=
" SET statut=-1, date_envoi=SYSDATE() WHERE rowid="
.
$obj
->
rowid
;
...
...
@@ -207,7 +211,7 @@ if ($resql)
if
(
!
$nbko
)
$statut
=
3
;
$sql
=
"UPDATE "
.
MAIN_DB_PREFIX
.
"mailing SET statut="
.
$statut
.
" WHERE rowid="
.
$id
;
dol_syslog
(
"
mailing-send:
update global status sql="
.
$sql
,
LOG_DEBUG
);
dol_syslog
(
"update global status sql="
.
$sql
,
LOG_DEBUG
);
$resql2
=
$db
->
query
(
$sql
);
if
(
!
$resql2
)
{
...
...
@@ -216,7 +220,6 @@ if ($resql)
}
else
{
dol_syslog
(
$db
->
error
());
dol_print_error
(
$db
);
}
...
...
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