27 if (!defined(
'NOSESSION')) {
28 define(
'NOSESSION',
'1');
31 $sapi_type = php_sapi_name();
32 $script_file = basename(__FILE__);
36 if (substr($sapi_type, 0, 3) ==
'cgi') {
37 echo
"Error: You are using PHP for CGI. To execute ".$script_file.
" from command line, you must use PHP for CLI mode.\n";
41 require_once $path.
"../../htdocs/master.inc.php";
42 require_once DOL_DOCUMENT_ROOT.
"/core/class/ldap.class.php";
43 require_once DOL_DOCUMENT_ROOT.
"/adherents/class/adherent.class.php";
48 $version = constant(
'DOL_VERSION');
57 print
"***** ".$script_file.
" (".$version.
") pid=".
dol_getmypid().
" *****\n";
58 dol_syslog($script_file.
" launched with arg ".join(
',', $argv));
60 if (!isset($argv[1]) || !$argv[1]) {
61 print
"Usage: $script_file now [-y]\n";
65 foreach ($argv as $key => $val) {
66 if (preg_match(
'/-y$/', $val, $reg)) {
71 if (!empty($dolibarr_main_db_readonly)) {
72 print
"Error: instance in read-onyl mode\n";
78 print
"Mails sending disabled (useless in batch mode)\n";
79 $conf->global->MAIN_DISABLE_ALL_MAILS = 1;
81 print
"----- Synchronize all records from Dolibarr database:\n";
82 print
"type=".$conf->db->type.
"\n";
83 print
"host=".$conf->db->host.
"\n";
84 print
"port=".$conf->db->port.
"\n";
85 print
"login=".$conf->db->user.
"\n";
87 print
"database=".$conf->db->name.
"\n";
89 print
"----- To LDAP database:\n";
90 print
"host=".$conf->global->LDAP_SERVER_HOST.
"\n";
91 print
"port=".$conf->global->LDAP_SERVER_PORT.
"\n";
92 print
"login=".$conf->global->LDAP_ADMIN_DN.
"\n";
93 print
"pass=".preg_replace(
'/./i',
'*', $conf->global->LDAP_ADMIN_PASS).
"\n";
94 print
"DN target=".$conf->global->LDAP_MEMBER_DN.
"\n";
98 print
"Press a key to confirm...\n";
99 $input = trim(fgets(STDIN));
100 print
"Warning, this operation may result in data loss if it failed.\n";
101 print
"Be sure to have a backup of your LDAP database (With OpenLDAP: slapcat > save.ldif).\n";
102 print
"Hit Enter to continue or CTRL+C to stop...\n";
103 $input = trim(fgets(STDIN));
114 $sql =
"SELECT rowid";
115 $sql .=
" FROM ".MAIN_DB_PREFIX.
"adherent";
117 $resql = $db->query($sql);
119 $num = $db->num_rows(
$resql);
123 $ldap->connect_bind();
128 $obj = $db->fetch_object(
$resql);
131 $result = $member->fetch($obj->rowid);
136 $result = $member->fetch_subscriptions();
142 print $langs->transnoentities(
"UpdateMember").
" rowid=".$member->id.
" ".$member->getFullName($langs);
144 $oldobject = $member;
146 $oldinfo = $oldobject->_load_ldap_info();
147 $olddn = $oldobject->_load_ldap_dn($oldinfo);
149 $info = $member->_load_ldap_info();
150 $dn = $member->_load_ldap_dn($info);
152 $result = $ldap->add($dn, $info, $user);
153 $result = $ldap->update($dn, $info, $user, $olddn);
155 print
" - ".$langs->transnoentities(
"OK");
158 print
" - ".$langs->transnoentities(
"KO").
' - '.$ldap->error;
Class to manage members of a foundation.
Class to manage LDAP features.
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("supplier_invoice", "lire"))) if(isModEnabled('don') &&!empty($user->rights->don->lire)) if(isModEnabled('tax') &&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture') &&isModEnabled('commande') && $user->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
dol_getmypid()
Return getmypid() or random PID when function is disabled Some web hosts disable this php function fo...
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.