25 if (!defined(
'NOSESSION')) define(
'NOSESSION',
'1');
26 if (!defined(
'MAXEMAILS')) define(
'MAXEMAILS', 100);
28 $sapi_type = php_sapi_name();
29 $script_file = basename(__FILE__);
33 if (substr($sapi_type, 0, 3) ==
'cgi') {
34 echo
"Error: You are using PHP for CGI. To execute ".$script_file.
" from command line, you must use PHP for CLI mode.\n";
38 if (!isset($argv[3]) || !$argv[3]) {
39 print "Usage: ".$script_file.
" inputfile-with-invalid-emails type [test|confirm]\n";
40 print "- inputfile-with-invalid-emails is a file with list of invalid email\n";
41 print "- type can be 'all' or 'thirdparties', 'contacts', 'members', 'users'\n";
44 $fileofinvalidemail = $argv[1];
48 require_once $path.
"../../htdocs/master.inc.php";
49 require_once DOL_DOCUMENT_ROOT.
"/core/class/CMailFile.class.php";
50 require_once DOL_DOCUMENT_ROOT.
"/comm/mailing/class/mailing.class.php";
53 $version = DOL_VERSION;
60 $user =
new User($db);
65 if (!in_array($type, array(
'all',
'thirdparties',
'contacts',
'users',
'members'))) {
66 print "Bad value for parameter type.\n";
73 $myfile = fopen($fileofinvalidemail,
"r");
76 echo
"Failed to open file";
86 $groupofemails = array();
87 for ($i = 0; $i < MAXEMAILS; $i++)
89 $tmp = fgets($myfile);
94 $groupofemails[$i] = trim($tmp,
"\n");
99 foreach ($groupofemails as $email) {
100 $emailsin .= ($emailsin ?
", " :
"").
"'".$db->escape($email).
"'";
104 $nbingroup = count($groupofemails);
106 print "Process group of ".$nbingroup.
" emails (".$counter.
" - ".($counter + $nbingroup - 1).
"), type = ".$type.
"\n";
110 $sql_base =
"UPDATE ".MAIN_DB_PREFIX;
112 if ($type ==
'all' || $type ==
'users')
115 $sql = $sql_base.
"user as u SET u.email = NULL WHERE u.email IN (".$emailsin.
");";
116 print "Try to update users, ";
117 $resql = $db->query($sql);
121 $numerased += $db->affected_rows(
$resql);
124 if ($type ==
'all' || $type ==
'thirdparties')
127 $sql = $sql_base.
"societe as s SET s.email = NULL WHERE s.email IN (".$emailsin.
");";
128 print "Try to update thirdparties, ";
129 $resql = $db->query($sql);
133 $numerased += $db->affected_rows(
$resql);
136 if ($type ==
'all' || $type ==
'contacts')
140 $sql = $sql_base.
"socpeople as s SET s.email = NULL WHERE s.email IN (".$emailsin.
");";
141 print "Try to update contacts, ";
142 $resql = $db->query($sql);
146 $numerased += $db->affected_rows(
$resql);
149 if ($type ==
'all' || $type ==
'members')
153 $sql = $sql_base.
"adherent as a SET a.email = NULL WHERE a.email IN (".$emailsin.
");";
154 print "Try to update members, ";
155 $resql = $db->query($sql);
159 $numerased += $db->affected_rows(
$resql);
162 $numerasedtotal += $numerased;
164 print $numerased.
" emails cleared.\n";
165 $counter = $counter + $nbingroup;
168 if (!$error && $mode ==
'confirm') {
169 print "Commit - ".$numerasedtotal.
" operations validated.\n";
172 print "Rollback - ".$numerasedtotal.
" Operations canceled.\n";
Class to manage Dolibarr users.
dol_getmypid()
Return getmypid() or random PID when function is disabled Some web hosts disable this php function fo...
print
Draft customers invoices.
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->don->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if((!empty($conf->fournisseur->enabled)&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)||!empty($conf->supplier_invoice->enabled))&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.