27 if (!defined(
'NOSESSION')) define(
'NOSESSION',
'1');
29 $sapi_type = php_sapi_name();
30 $script_file = basename(__FILE__);
34 if (substr($sapi_type, 0, 3) ==
'cgi') {
35 echo
"Error: You are using PHP for CGI. To execute ".$script_file.
" from command line, you must use PHP for CLI mode.\n";
39 require_once $path.
"../../htdocs/master.inc.php";
40 require_once DOL_DOCUMENT_ROOT.
"/core/class/ldap.class.php";
41 require_once DOL_DOCUMENT_ROOT.
"/adherents/class/adherent.class.php";
46 $version = constant(
'DOL_VERSION');
56 dol_syslog($script_file.
" launched with arg ".join(
',', $argv));
58 if (!isset($argv[1]) || !$argv[1]) {
59 print "Usage: $script_file now [-y]\n";
63 foreach ($argv as $key => $val) {
64 if (preg_match(
'/-y$/', $val, $reg))
70 print "Mails sending disabled (useless in batch mode)\n";
71 $conf->global->MAIN_DISABLE_ALL_MAILS = 1;
73 print "----- Synchronize all records from Dolibarr database:\n";
74 print "type=".$conf->db->type.
"\n";
75 print "host=".$conf->db->host.
"\n";
76 print "port=".$conf->db->port.
"\n";
77 print "login=".$conf->db->user.
"\n";
79 print "database=".$conf->db->name.
"\n";
81 print "----- To LDAP database:\n";
82 print "host=".$conf->global->LDAP_SERVER_HOST.
"\n";
83 print "port=".$conf->global->LDAP_SERVER_PORT.
"\n";
84 print "login=".$conf->global->LDAP_ADMIN_DN.
"\n";
85 print "pass=".preg_replace(
'/./i',
'*', $conf->global->LDAP_ADMIN_PASS).
"\n";
86 print "DN target=".$conf->global->LDAP_MEMBER_DN.
"\n";
90 print "Press a key to confirm...\n";
91 $input = trim(fgets(STDIN));
92 print "Warning, this operation may result in data loss if it failed.\n";
93 print "Be sure to have a backup of your LDAP database (With OpenLDAP: slapcat > save.ldif).\n";
94 print "Hit Enter to continue or CTRL+C to stop...\n";
95 $input = trim(fgets(STDIN));
106 $sql =
"SELECT rowid";
107 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent";
109 $resql = $db->query($sql);
111 $num = $db->num_rows(
$resql);
115 $ldap->connect_bind();
120 $obj = $db->fetch_object(
$resql);
123 $result = $member->fetch($obj->rowid);
128 $result = $member->fetch_subscriptions();
134 print $langs->transnoentities(
"UpdateMember").
" rowid=".$member->id.
" ".$member->getFullName($langs);
136 $oldobject = $member;
138 $oldinfo = $oldobject->_load_ldap_info();
139 $olddn = $oldobject->_load_ldap_dn($oldinfo);
141 $info = $member->_load_ldap_info();
142 $dn = $member->_load_ldap_dn($info);
144 $result = $ldap->add($dn, $info, $user);
145 $result = $ldap->update($dn, $info, $user, $olddn);
147 print " - ".$langs->transnoentities(
"OK");
150 print " - ".$langs->transnoentities(
"KO").
' - '.$ldap->error;
dol_getmypid()
Return getmypid() or random PID when function is disabled Some web hosts disable this php function fo...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Class to manage members of a foundation.
Class to manage LDAP features.
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...