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.
"/contact/class/contact.class.php";
41 require_once DOL_DOCUMENT_ROOT.
"/user/class/user.class.php";
42 require_once DOL_DOCUMENT_ROOT.
"/core/class/ldap.class.php";
45 $version = DOL_VERSION;
55 dol_syslog($script_file.
" launched with arg ".join(
',', $argv));
57 if (!isset($argv[1]) || !$argv[1]) {
58 print "Usage: $script_file now [-y]\n";
62 foreach ($argv as $key => $val) {
63 if (preg_match(
'/-y$/', $val, $reg))
69 print "Mails sending disabled (useless in batch mode)\n";
70 $conf->global->MAIN_DISABLE_ALL_MAILS = 1;
72 print "----- Synchronize all records from Dolibarr database:\n";
73 print "type=".$conf->db->type.
"\n";
74 print "host=".$conf->db->host.
"\n";
75 print "port=".$conf->db->port.
"\n";
76 print "login=".$conf->db->user.
"\n";
78 print "database=".$conf->db->name.
"\n";
80 print "----- To LDAP database:\n";
81 print "host=".$conf->global->LDAP_SERVER_HOST.
"\n";
82 print "port=".$conf->global->LDAP_SERVER_PORT.
"\n";
83 print "login=".$conf->global->LDAP_ADMIN_DN.
"\n";
84 print "pass=".preg_replace(
'/./i',
'*', $conf->global->LDAP_ADMIN_PASS).
"\n";
85 print "DN target=".$conf->global->LDAP_CONTACT_DN.
"\n";
89 print "Press a key to confirm...\n";
90 $input = trim(fgets(STDIN));
91 print "Warning, this operation may result in data loss if it failed.\n";
92 print "Be sure to have a backup of your LDAP database (With OpenLDAP: slapcat > save.ldif).\n";
93 print "Hit Enter to continue or CTRL+C to stop...\n";
94 $input = trim(fgets(STDIN));
105 $sql =
"SELECT rowid";
106 $sql .=
" FROM ".MAIN_DB_PREFIX.
"socpeople";
108 $resql = $db->query($sql);
110 $num = $db->num_rows(
$resql);
114 $ldap->connect_bind();
119 $obj = $db->fetch_object(
$resql);
122 $contact->id = $obj->rowid;
123 $contact->fetch($contact->id);
125 print $langs->trans(
"UpdateContact").
" rowid=".$contact->id.
" ".$contact->getFullName($langs);
127 $oldobject = $contact;
129 $oldinfo = $oldobject->_load_ldap_info();
130 $olddn = $oldobject->_load_ldap_dn($oldinfo);
132 $info = $contact->_load_ldap_info();
133 $dn = $contact->_load_ldap_dn($info);
135 $result = $ldap->add($dn, $info, $user);
136 $result = $ldap->update($dn, $info, $user, $olddn);
138 print " - ".$langs->trans(
"OK");
141 print " - ".$langs->trans(
"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 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...