26 include_once
'inc.php';
27 if (file_exists($conffile)) include_once $conffile;
28 require_once $dolibarr_main_document_root.
'/core/lib/admin.lib.php';
29 include_once $dolibarr_main_document_root.
'/core/lib/images.lib.php';
30 require_once $dolibarr_main_document_root.
'/core/class/extrafields.class.php';
31 require_once
'lib/repair.lib.php';
39 $err = error_reporting();
42 error_reporting($err);
44 $setuplang =
GETPOST(
"selectlang",
'aZ09', 3) ?
GETPOST(
"selectlang",
'aZ09', 3) :
'auto';
45 $langs->setDefaultLang($setuplang);
47 $langs->loadLangs(array(
"admin",
"install",
"other"));
49 if ($dolibarr_main_db_type ==
"mysqli") $choix = 1;
50 if ($dolibarr_main_db_type ==
"pgsql") $choix = 2;
51 if ($dolibarr_main_db_type ==
"mssql") $choix = 3;
67 print '<h3>'.$langs->trans(
"Repair").
'</h3>';
69 print 'Option standard (\'test\' or \'confirmed\') is '.(GETPOST(
'standard',
'alpha') ?
GETPOST(
'standard',
'alpha') :
'undefined').
'<br>'.
"\n";
71 print 'Option force_disable_of_modules_not_found (\'test\' or \'confirmed\') is '.(GETPOST(
'force_disable_of_modules_not_found',
'alpha') ?
GETPOST(
'force_disable_of_modules_not_found',
'alpha') :
'undefined').
'<br>'.
"\n";
73 print 'Option restore_thirdparties_logos (\'test\' or \'confirmed\') is '.(GETPOST(
'restore_thirdparties_logos',
'alpha') ?
GETPOST(
'restore_thirdparties_logos',
'alpha') :
'undefined').
'<br>'.
"\n";
74 print 'Option restore_user_pictures (\'test\' or \'confirmed\') is '.(GETPOST(
'restore_user_pictures',
'alpha') ?
GETPOST(
'restore_user_pictures',
'alpha') :
'undefined').
'<br>'.
"\n";
75 print 'Option rebuild_product_thumbs (\'test\' or \'confirmed\') is '.(GETPOST(
'rebuild_product_thumbs',
'alpha') ?
GETPOST(
'rebuild_product_thumbs',
'alpha') :
'undefined').
'<br>'.
"\n";
77 print 'Option clean_linked_elements (\'test\' or \'confirmed\') is '.(GETPOST(
'clean_linked_elements',
'alpha') ?
GETPOST(
'clean_linked_elements',
'alpha') :
'undefined').
'<br>'.
"\n";
78 print 'Option clean_menus (\'test\' or \'confirmed\') is '.(GETPOST(
'clean_menus',
'alpha') ?
GETPOST(
'clean_menus',
'alpha') :
'undefined').
'<br>'.
"\n";
79 print 'Option clean_orphelin_dir (\'test\' or \'confirmed\') is '.(GETPOST(
'clean_orphelin_dir',
'alpha') ?
GETPOST(
'clean_orphelin_dir',
'alpha') :
'undefined').
'<br>'.
"\n";
80 print 'Option clean_product_stock_batch (\'test\' or \'confirmed\') is '.(GETPOST(
'clean_product_stock_batch',
'alpha') ?
GETPOST(
'clean_product_stock_batch',
'alpha') :
'undefined').
'<br>'.
"\n";
81 print 'Option clean_perm_table (\'test\' or \'confirmed\') is '.(GETPOST(
'clean_perm_table',
'alpha') ?
GETPOST(
'clean_perm_table',
'alpha') :
'undefined').
'<br>'.
"\n";
82 print 'Option repair_link_dispatch_lines_supplier_order_lines, (\'test\' or \'confirmed\') is '.(GETPOST(
'repair_link_dispatch_lines_supplier_order_lines',
'alpha') ?
GETPOST(
'repair_link_dispatch_lines_supplier_order_lines',
'alpha') :
'undefined').
'<br>'.
"\n";
84 print 'Option set_empty_time_spent_amount (\'test\' or \'confirmed\') is '.(GETPOST(
'set_empty_time_spent_amount',
'alpha') ?
GETPOST(
'set_empty_time_spent_amount',
'alpha') :
'undefined').
'<br>'.
"\n";
86 print 'Option force_utf8_on_tables, for mysql/mariadb only (\'test\' or \'confirmed\') is '.(GETPOST(
'force_utf8_on_tables',
'alpha') ?
GETPOST(
'force_utf8_on_tables',
'alpha') :
'undefined').
'<br>'.
"\n";
89 print '<table cellspacing="0" cellpadding="1" border="0" width="100%">';
93 if (preg_match(
'/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass))
95 require_once $dolibarr_main_document_root.
'/core/lib/security.lib.php';
96 if (preg_match(
'/crypted:/i', $dolibarr_main_db_pass))
98 $dolibarr_main_db_pass = preg_replace(
'/crypted:/i',
'', $dolibarr_main_db_pass);
99 $dolibarr_main_db_pass =
dol_decode($dolibarr_main_db_pass);
100 $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass;
101 }
else $dolibarr_main_db_pass =
dol_decode($dolibarr_main_db_encrypted_pass);
105 $conf->db->type = $dolibarr_main_db_type;
106 $conf->db->host = $dolibarr_main_db_host;
107 $conf->db->port = $dolibarr_main_db_port;
108 $conf->db->name = $dolibarr_main_db_name;
109 $conf->db->user = $dolibarr_main_db_user;
110 $conf->db->pass = $dolibarr_main_db_pass;
113 $conf->db->dolibarr_main_db_encryption = isset($dolibarr_main_db_encryption) ? $dolibarr_main_db_encryption :
'';
114 $conf->db->dolibarr_main_db_cryptkey = isset($dolibarr_main_db_cryptkey) ? $dolibarr_main_db_cryptkey :
'';
116 $db =
getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port);
120 print '<tr><td class="nowrap">';
121 print $langs->trans(
"ServerConnection").
" : $dolibarr_main_db_host</td><td class=\"right\">".$langs->trans(
"OK").
"</td></tr>";
122 dolibarr_install_syslog(
"repair: ".$langs->transnoentities(
"ServerConnection").
": ".$dolibarr_main_db_host.$langs->transnoentities(
"OK"));
125 print "<tr><td>".$langs->trans(
"ErrorFailedToConnectToDatabase", $dolibarr_main_db_name).
"</td><td class=\"right\">".$langs->transnoentities(
"Error").
"</td></tr>";
126 dolibarr_install_syslog(
"repair: ".$langs->transnoentities(
"ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
132 if ($db->database_selected)
134 print '<tr><td class="nowrap">';
135 print $langs->trans(
"DatabaseConnection").
" : ".$dolibarr_main_db_name.
"</td><td class=\"right\">".$langs->trans(
"OK").
"</td></tr>";
139 print "<tr><td>".$langs->trans(
"ErrorFailedToConnectToDatabase", $dolibarr_main_db_name).
"</td><td class=\"right\">".$langs->trans(
"Error").
"</td></tr>";
140 dolibarr_install_syslog(
"repair: ".$langs->transnoentities(
"ErrorFailedToConnectToDatabase", $dolibarr_main_db_name));
148 $version = $db->getVersion();
149 $versionarray = $db->getVersionArray();
150 print '<tr><td>'.$langs->trans(
"ServerVersion").
'</td>';
151 print '<td class="right">'.$version.
'</td></tr>';
156 $conf->setValues($db);
158 if (defined(
'SYSLOG_FILE')) $conf->global->SYSLOG_FILE = constant(
'SYSLOG_FILE');
159 $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1;
164 $oneoptionset = (
GETPOST(
'standard',
'alpha') ||
GETPOST(
'restore_thirdparties_logos',
'alpha') ||
GETPOST(
'clean_linked_elements',
'alpha') ||
GETPOST(
'clean_menus',
'alpha')
165 ||
GETPOST(
'clean_orphelin_dir',
'alpha') ||
GETPOST(
'clean_product_stock_batch',
'alpha') ||
GETPOST(
'set_empty_time_spent_amount',
'alpha') ||
GETPOST(
'rebuild_product_thumbs',
'alpha')
166 ||
GETPOST(
'clean_perm_table',
'alpha')
167 ||
GETPOST(
'force_disable_of_modules_not_found',
'alpha') ||
GETPOST(
'force_utf8_on_tables',
'alpha'));
169 if ($ok && $oneoptionset)
172 print '<tr><td colspan="2">'.$langs->trans(
"PleaseBePatient").
'<br><br></td></tr>';
178 if ($ok &&
GETPOST(
'standard',
'alpha'))
180 $dir =
"mysql/migration/";
187 $filesindir = array();
188 $handle = opendir($dir);
189 if (is_resource($handle))
191 while (($file = readdir($handle)) !==
false)
193 if (preg_match(
'/\.sql$/i', $file)) $filesindir[] = $file;
198 foreach ($filesindir as $file)
200 if (preg_match(
'/repair/i', $file))
207 foreach ($filelist as $file)
209 print '<tr><td class="nowrap">*** ';
210 print $langs->trans(
"Script").
'</td><td class="right">'.$file.
'</td></tr>';
212 $name = substr($file, 0,
dol_strlen($file) - 4);
215 $ok =
run_sql($dir.$file, 0,
'', 1);
222 if ($ok &&
GETPOST(
'standard',
'alpha'))
225 $listofmodulesextra = array(
'societe'=>
'societe',
'adherent'=>
'adherent',
'product'=>
'product',
226 'socpeople'=>
'socpeople',
'propal'=>
'propal',
'commande'=>
'commande',
'facture'=>
'facture',
227 'supplier_proposal'=>
'supplier_proposal',
'commande_fournisseur'=>
'commande_fournisseur',
'facture_fourn'=>
'facture_fourn',
228 'actioncomm'=>
'actioncomm',
'bom_bom'=>
'bom_bom',
'mrp_mo'=>
'mrp_mo',
229 'adherent_type'=>
'adherent_type',
'user'=>
'user',
'projet'=>
'projet',
'projet_task'=>
'projet_task');
230 print '<tr><td colspan="2"><br>*** Check fields into extra table structure match table of definition. If not add column into table</td></tr>';
231 foreach ($listofmodulesextra as $tablename => $elementtype)
234 $tableextra = MAIN_DB_PREFIX.$tablename.
'_extrafields';
237 $arrayoffieldsdesc = $extrafields->fetch_name_optionals_label($elementtype);
240 $arrayoffieldsfound = array();
241 $resql = $db->DDLDescTable($tableextra);
244 print '<tr><td>Check availability of extra field for '.$tableextra.
"<br>\n";
246 while ($obj = $db->fetch_object(
$resql))
248 $fieldname = $fieldtype =
'';
249 if (preg_match(
'/mysql/', $db->type))
251 $fieldname = $obj->Field;
252 $fieldtype = $obj->Type;
254 $fieldname = isset($obj->Key) ? $obj->Key : $obj->attname;
255 $fieldtype = isset($obj->Type) ? $obj->Type :
'varchar';
258 if (empty($fieldname))
continue;
259 if (in_array($fieldname, array(
'rowid',
'tms',
'fk_object',
'import_key')))
continue;
260 $arrayoffieldsfound[$fieldname] = array(
'type'=>$fieldtype);
264 foreach ($arrayoffieldsdesc as $code => $label)
266 if (!in_array($code, array_keys($arrayoffieldsfound)))
268 print 'Found field '.$code.
' declared into '.MAIN_DB_PREFIX.
'extrafields table but not found into desc of table '.$tableextra.
" -> ";
269 $type = $extrafields->attributes[$elementtype][
'type'][$code]; $length = $extrafields->attributes[$elementtype][
'size'][$code]; $attribute =
''; $default =
''; $extra =
''; $null =
'null';
271 if ($type ==
'boolean') {
274 } elseif ($type ==
'price') {
277 } elseif ($type ==
'phone') {
280 } elseif ($type ==
'mail') {
283 } elseif (($type ==
'select') || ($type ==
'sellist') || ($type ==
'radio') || ($type ==
'checkbox') || ($type ==
'chkbxlst')) {
286 } elseif ($type ==
'link') {
297 'attribute'=>$attribute,
305 if (
GETPOST(
'standard',
'alpha') ==
'confirmed')
307 $result = $db->DDLAddField($tableextra, $code, $field_desc,
"");
311 print "KO ".$db->lasterror.
"<br>\n";
316 print ' - Mode test, no column added.';
321 print "</td><td> </td></tr>\n";
330 if ($ok &&
GETPOST(
'standard',
'alpha'))
337 if ($ok &&
GETPOST(
'standard',
'alpha'))
339 print '<tr><td colspan="2"><br>*** Clean constant record of modules not enabled</td></tr>';
341 $sql =
"SELECT name, entity, value";
342 $sql .=
" FROM ".MAIN_DB_PREFIX.
"const as c";
343 $sql .=
" WHERE name LIKE 'MAIN_MODULE_%_TPL' OR name LIKE 'MAIN_MODULE_%_CSS' OR name LIKE 'MAIN_MODULE_%_JS' OR name LIKE 'MAIN_MODULE_%_HOOKS'";
344 $sql .=
" OR name LIKE 'MAIN_MODULE_%_TRIGGERS' OR name LIKE 'MAIN_MODULE_%_THEME' OR name LIKE 'MAIN_MODULE_%_SUBSTITUTIONS' OR name LIKE 'MAIN_MODULE_%_MODELS'";
345 $sql .=
" OR name LIKE 'MAIN_MODULE_%_MENUS' OR name LIKE 'MAIN_MODULE_%_LOGIN' OR name LIKE 'MAIN_MODULE_%_BARCODE' OR name LIKE 'MAIN_MODULE_%_TABS_%'";
346 $sql .=
" OR name LIKE 'MAIN_MODULE_%_MODULEFOREXTERNAL'";
347 $sql .=
" ORDER BY name, entity";
349 $resql = $db->query($sql);
352 $num = $db->num_rows(
$resql);
361 $obj = $db->fetch_object(
$resql);
364 if (preg_match(
'/MAIN_MODULE_([^_]+)_(.+)/i', $obj->name, $reg))
369 $sql2 =
"SELECT COUNT(*) as nb";
370 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"const as c";
371 $sql2 .=
" WHERE name = 'MAIN_MODULE_".$name.
"'";
372 $sql2 .=
" AND entity = ".$obj->entity;
373 $resql2 = $db->query($sql2);
376 $obj2 = $db->fetch_object($resql2);
377 if ($obj2 && $obj2->nb == 0)
380 $sqldelete =
"DELETE FROM ".MAIN_DB_PREFIX.
"const WHERE name = '".$db->escape($obj->name).
"' AND entity = ".$obj->entity;
382 if (
GETPOST(
'standard',
'alpha') ==
'confirmed')
384 $db->query($sqldelete);
386 print '<tr><td>Widget '.$obj->name.
' set in entity '.$obj->entity.
' with value '.$obj->value.
' -> Module '.$name.
' not enabled in entity '.$obj->entity.
', we delete record</td></tr>';
388 print '<tr><td>Widget '.$obj->name.
' set in entity '.$obj->entity.
' with value '.$obj->value.
' -> Module '.$name.
' not enabled in entity '.$obj->entity.
', we should delete record (not done, mode test)</td></tr>';
408 if ($ok &&
GETPOST(
'standard',
'alpha'))
410 print '<tr><td colspan="2"><br>*** Clean definition of boxes of modules not enabled</td></tr>';
412 $sql =
"SELECT file, entity FROM ".MAIN_DB_PREFIX.
"boxes_def";
413 $sql .=
" WHERE file like '%@%'";
415 $resql = $db->query($sql);
418 $num = $db->num_rows(
$resql);
427 $obj = $db->fetch_object(
$resql);
430 if (preg_match(
'/^(.+)@(.+)$/i', $obj->file, $reg))
435 $sql2 =
"SELECT COUNT(*) as nb";
436 $sql2 .=
" FROM ".MAIN_DB_PREFIX.
"const as c";
437 $sql2 .=
" WHERE name = 'MAIN_MODULE_".strtoupper($module).
"'";
438 $sql2 .=
" AND entity = ".$obj->entity;
439 $sql2 .=
" AND value <> 0";
440 $resql2 = $db->query($sql2);
443 $obj2 = $db->fetch_object($resql2);
444 if ($obj2 && $obj2->nb == 0)
447 $sqldeletea =
"DELETE FROM ".MAIN_DB_PREFIX.
"boxes WHERE entity = ".$obj->entity.
" AND box_id IN (SELECT rowid FROM ".MAIN_DB_PREFIX.
"boxes_def WHERE file = '".$db->escape($obj->file).
"' AND entity = ".$obj->entity.
")";
448 $sqldeleteb =
"DELETE FROM ".MAIN_DB_PREFIX.
"boxes_def WHERE file = '".$db->escape($obj->file).
"' AND entity = ".$obj->entity;
450 if (
GETPOST(
'standard',
'alpha') ==
'confirmed')
452 $db->query($sqldeletea);
453 $db->query($sqldeleteb);
455 print '<tr><td>Constant '.$obj->file.
' set in boxes_def for entity '.$obj->entity.
' but MAIN_MODULE_'.strtoupper($module).
' not defined in entity '.$obj->entity.
', we delete record</td></tr>';
457 print '<tr><td>Constant '.$obj->file.
' set in boxes_def for entity '.$obj->entity.
' but MAIN_MODULE_'.strtoupper($module).
' not defined in entity '.$obj->entity.
', we should delete record (not done, mode test)</td></tr>';
475 if ($ok &&
GETPOST(
'restore_thirdparties_logos'))
481 print '<tr><td colspan="2"><br>*** Restore thirdparties logo<br>';
483 $sql =
"SELECT s.rowid, s.nom as name, s.logo FROM ".MAIN_DB_PREFIX.
"societe as s ORDER BY s.nom";
484 $resql = $db->query($sql);
487 $num = $db->num_rows(
$resql);
492 $obj = $db->fetch_object(
$resql);
500 $tmp = explode(
'.', $obj->logo);
502 if (isset($tmp[1])) $ext =
'.'.$tmp[1];
506 $filetotest = $dolibarr_main_data_root.
'/societe/logos/'.$name.$ext;
507 $filetotestsmall = $dolibarr_main_data_root.
'/societe/logos/thumbs/'.$name.
'_small'.$ext;
509 print 'Check thirdparty '.$obj->rowid.
' name='.$obj->name.
' logo='.$obj->logo.
' file '.$filetotest.
" exists=".$exists.
"<br>\n";
512 $filetarget = $dolibarr_main_data_root.
'/societe/'.$obj->rowid.
'/logos/'.$name.$ext;
513 $filetargetsmall = $dolibarr_main_data_root.
'/societe/'.$obj->rowid.
'/logos/thumbs/'.$name.
'_small'.$ext;
517 if (
GETPOST(
'restore_thirdparties_logos',
'alpha') ==
'confirmed')
519 dol_mkdir($dolibarr_main_data_root.
'/societe/'.$obj->rowid.
'/logos');
522 print " -> Copy file ".$filetotest.
" -> ".$filetarget.
"<br>\n";
523 if (
GETPOST(
'restore_thirdparties_logos',
'alpha') ==
'confirmed')
525 dol_copy($filetotest, $filetarget,
'', 0);
532 if (
GETPOST(
'restore_thirdparties_logos',
'alpha') ==
'confirmed')
534 dol_mkdir($dolibarr_main_data_root.
'/societe/'.$obj->rowid.
'/logos/thumbs');
536 print " -> Copy file ".$filetotestsmall.
" -> ".$filetargetsmall.
"<br>\n";
537 if (
GETPOST(
'restore_thirdparties_logos',
'alpha') ==
'confirmed')
539 dol_copy($filetotestsmall, $filetargetsmall,
'', 0);
558 if ($ok &&
GETPOST(
'restore_user_pictures',
'alpha'))
564 print '<tr><td colspan="2"><br>*** Restore user pictures<br>';
566 $sql =
"SELECT s.rowid, s.firstname, s.lastname, s.login, s.photo FROM ".MAIN_DB_PREFIX.
"user as s ORDER BY s.rowid";
567 $resql = $db->query($sql);
570 $num = $db->num_rows(
$resql);
575 $obj = $db->fetch_object(
$resql);
583 $tmp = explode(
'.', $obj->photo);
585 if (isset($tmp[1])) $ext =
'.'.$tmp[1];
589 $filetotest = $dolibarr_main_data_root.
'/users/'.substr(sprintf(
'%08d', $obj->rowid), -1, 1).
'/'.substr(sprintf(
'%08d', $obj->rowid), -2, 1).
'/'.$name.$ext;
590 $filetotestsmall = $dolibarr_main_data_root.
'/users/'.substr(sprintf(
'%08d', $obj->rowid), -1, 1).
'/'.substr(sprintf(
'%08d', $obj->rowid), -2, 1).
'/thumbs/'.$name.
'_small'.$ext;
591 $filetotestmini = $dolibarr_main_data_root.
'/users/'.substr(sprintf(
'%08d', $obj->rowid), -1, 1).
'/'.substr(sprintf(
'%08d', $obj->rowid), -2, 1).
'/thumbs/'.$name.
'_mini'.$ext;
593 print 'Check user '.$obj->rowid.
' lastname='.$obj->lastname.
' fistname='.$obj->firstname.
' photo='.$obj->photo.
' file '.$filetotest.
" exists=".$exists.
"<br>\n";
596 $filetarget = $dolibarr_main_data_root.
'/users/'.$obj->rowid.
'/'.$name.$ext;
597 $filetargetsmall = $dolibarr_main_data_root.
'/users/'.$obj->rowid.
'/thumbs/'.$name.
'_small'.$ext;
598 $filetargetmini = $dolibarr_main_data_root.
'/users/'.$obj->rowid.
'/thumbs/'.$name.
'_mini'.$ext;
603 if (
GETPOST(
'restore_user_pictures',
'alpha') ==
'confirmed')
605 dol_mkdir($dolibarr_main_data_root.
'/users/'.$obj->rowid);
608 print " -> Copy file ".$filetotest.
" -> ".$filetarget.
"<br>\n";
609 if (
GETPOST(
'restore_user_pictures',
'alpha') ==
'confirmed')
611 dol_copy($filetotest, $filetarget,
'', 0);
618 if (
GETPOST(
'restore_user_pictures',
'alpha') ==
'confirmed')
620 dol_mkdir($dolibarr_main_data_root.
'/users/'.$obj->rowid.
'/thumbs');
623 print " -> Copy file ".$filetotestsmall.
" -> ".$filetargetsmall.
"<br>\n";
624 if (
GETPOST(
'restore_user_pictures',
'alpha') ==
'confirmed')
626 dol_copy($filetotestsmall, $filetargetsmall,
'', 0);
633 if (
GETPOST(
'restore_user_pictures',
'alpha') ==
'confirmed')
635 dol_mkdir($dolibarr_main_data_root.
'/users/'.$obj->rowid.
'/thumbs');
638 print " -> Copy file ".$filetotestmini.
" -> ".$filetargetmini.
"<br>\n";
639 if (
GETPOST(
'restore_user_pictures',
'alpha') ==
'confirmed')
641 dol_copy($filetotestmini, $filetargetmini,
'', 0);
659 if ($ok &&
GETPOST(
'rebuild_product_thumbs',
'alpha'))
662 global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini;
664 print '<tr><td colspan="2"><br>*** Rebuild product thumbs<br>';
666 $sql =
"SELECT s.rowid, s.ref FROM ".MAIN_DB_PREFIX.
"product as s ORDER BY s.ref";
667 $resql = $db->query($sql);
670 $num = $db->num_rows(
$resql);
675 $obj = $db->fetch_object(
$resql);
677 if (!empty($obj->ref))
679 $files =
dol_dir_list($dolibarr_main_data_root.
'/produit/'.$obj->ref,
'files', 0);
680 foreach ($files as $file)
685 $imgThumbSmall =
'notbuild';
686 if (
GETPOST(
'rebuild_product_thumbs',
'alpha') ==
'confirmed')
689 $imgThumbSmall =
vignette($file[
'fullname'], $maxwidthsmall, $maxheightsmall,
'_small', 50,
"thumbs");
691 print 'Check product '.$obj->rowid.
", file ".$file[
'fullname'].
" -> ".$imgThumbSmall.
" maxwidthsmall=".$maxwidthsmall.
" maxheightsmall=".$maxheightsmall.
"<br>\n";
692 $imgThumbMini =
'notbuild';
693 if (
GETPOST(
'rebuild_product_thumbs',
'alpha') ==
'confirmed')
697 $imgThumbMini =
vignette($file[
'fullname'], $maxwidthmini, $maxheightmini,
'_mini', 50,
"thumbs");
699 print 'Check product '.$obj->rowid.
", file ".$file[
'fullname'].
" -> ".$imgThumbMini.
" maxwidthmini=".$maxwidthmini.
" maxheightmini=".$maxheightmini.
"<br>\n";
715 if ($ok &&
GETPOST(
'clean_linked_elements',
'alpha'))
717 print '<tr><td colspan="2"><br>*** Check table of linked elements and delete orphelins links</td></tr>';
719 print '<tr><td colspan="2">'.checkLinkedElements(
'propal',
'commande').
"</td></tr>\n";
722 print '<tr><td colspan="2">'.checkLinkedElements(
'propal',
'facture').
"</td></tr>\n";
725 print '<tr><td colspan="2">'.checkLinkedElements(
'commande',
'facture').
"</td></tr>\n";
728 print '<tr><td colspan="2">'.checkLinkedElements(
'commande',
'shipping').
"</td></tr>\n";
731 print '<tr><td colspan="2">'.checkLinkedElements(
'shipping',
'delivery').
"</td></tr>\n";
734 print '<tr><td colspan="2">'.checkLinkedElements(
'order_supplier',
'invoice_supplier').
"</td></tr>\n";
739 if ($ok &&
GETPOST(
'clean_menus',
'alpha'))
741 print '<tr><td colspan="2"><br>*** Clean menu entries coming from disabled modules</td></tr>';
743 $sql =
"SELECT rowid, module";
744 $sql .=
" FROM ".MAIN_DB_PREFIX.
"menu as c";
745 $sql .=
" WHERE module IS NOT NULL AND module <> ''";
746 $sql .=
" ORDER BY module";
748 $resql = $db->query($sql);
751 $num = $db->num_rows(
$resql);
757 $obj = $db->fetch_object(
$resql);
759 $modulecond = $obj->module;
760 $modulecondarray = explode(
'|', $obj->module);
770 foreach ($modulecondarray as $tmpname)
772 if ($tmpname ==
'margins') $tmpname =
'margin';
775 if (!empty($conf->$tmpname)) $result = $conf->$tmpname->enabled;
776 if ($result) $moduleok++;
779 if (!$moduleok && $modulecond)
781 print ' - Module condition '.$modulecond.
' seems ko, we delete menu entry.';
782 if (
GETPOST(
'clean_menus') ==
'confirmed')
784 $sql2 =
"DELETE FROM ".MAIN_DB_PREFIX.
"menu WHERE module = '".$db->escape($modulecond).
"'";
785 $resql2 = $db->query($sql2);
790 }
else print ' - <span class="warning">Cleaned</span>';
792 print ' - <span class="warning">Canceled (test mode)</span>';
795 print ' - Module condition '.$modulecond.
' is ok, we do nothing.';
799 if (!$error) $db->commit();
800 else $db->rollback();
809 print '<tr><td>No menu entries of disabled menus found</td></tr>';
819 if ($ok &&
GETPOST(
'clean_orphelin_dir',
'alpha'))
821 $listmodulepart = array(
'company',
'invoice',
'invoice_supplier',
'propal',
'order',
'order_supplier',
'contract',
'tax');
822 foreach ($listmodulepart as $modulepart)
824 $filearray = array();
825 $upload_dir = isset($conf->$modulepart->dir_output) ? $conf->$modulepart->dir_output :
'';
826 if ($modulepart ==
'company') $upload_dir = $conf->societe->dir_output;
827 if ($modulepart ==
'invoice') $upload_dir = $conf->facture->dir_output;
828 if ($modulepart ==
'invoice_supplier') $upload_dir = $conf->fournisseur->facture->dir_output;
829 if ($modulepart ==
'order') $upload_dir = $conf->commande->dir_output;
830 if ($modulepart ==
'order_supplier') $upload_dir = $conf->fournisseur->commande->dir_output;
831 if ($modulepart ==
'contract') $upload_dir = $conf->contrat->dir_output;
833 if (empty($upload_dir))
continue;
835 print '<tr><td colspan="2"><br>*** Clean orphelins files into files '.$upload_dir.
'</td></tr>';
837 $filearray =
dol_dir_list($upload_dir,
"files", 1,
'', array(
'^SPECIMEN\.pdf$',
'^\.',
'(\.meta|_preview.*\.png)$',
'^temp$',
'^payments$',
'^CVS$',
'^thumbs$'),
'', SORT_DESC, 1,
true);
840 if ($modulepart ==
'company')
842 include_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
843 $object_instance =
new Societe($db);
845 if ($modulepart ==
'invoice')
847 include_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
848 $object_instance =
new Facture($db);
849 } elseif ($modulepart ==
'invoice_supplier')
851 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
853 } elseif ($modulepart ==
'propal')
855 include_once DOL_DOCUMENT_ROOT.
'/comm/propal/class/propal.class.php';
856 $object_instance =
new Propal($db);
857 } elseif ($modulepart ==
'order')
859 include_once DOL_DOCUMENT_ROOT.
'/commande/class/commande.class.php';
860 $object_instance =
new Commande($db);
861 } elseif ($modulepart ==
'order_supplier')
863 include_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.commande.class.php';
865 } elseif ($modulepart ==
'contract')
867 include_once DOL_DOCUMENT_ROOT.
'/contrat/class/contrat.class.php';
868 $object_instance =
new Contrat($db);
869 } elseif ($modulepart ==
'tax')
871 include_once DOL_DOCUMENT_ROOT.
'/compta/sociales/class/chargesociales.class.php';
875 foreach ($filearray as $key => $file)
877 if (!is_dir($file[
'name'])
878 && $file[
'name'] !=
'.'
879 && $file[
'name'] !=
'..'
880 && $file[
'name'] !=
'CVS'
884 $relativefile = preg_replace(
'/'.preg_quote($upload_dir.
'/',
'/').
'/',
'', $file[
'fullname']);
887 $id = 0; $ref =
''; $object_instance->id = 0; $object_instance->ref =
''; $label =
'';
890 if ($modulepart ==
'invoice') {
891 preg_match(
'/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = $reg[1];
893 if ($modulepart ==
'invoice_supplier') {
894 preg_match(
'/(\d+)\/[^\/]+$/', $relativefile, $reg); $id = empty($reg[1]) ?
'' : $reg[1];
896 if ($modulepart ==
'propal') {
897 preg_match(
'/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = $reg[1];
899 if ($modulepart ==
'order') {
900 preg_match(
'/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = $reg[1];
902 if ($modulepart ==
'order_supplier') {
903 preg_match(
'/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = $reg[1];
905 if ($modulepart ==
'contract') {
906 preg_match(
'/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = $reg[1];
908 if ($modulepart ==
'tax') {
909 preg_match(
'/(\d+)\/[^\/]+$/', $relativefile, $reg); $id = $reg[1];
915 $result = $object_instance->fetch($id, $ref);
920 print '<tr><td colspan="2">';
921 print 'Delete orphelins file '.$file[
'fullname'].
'<br>';
922 if (
GETPOST(
'clean_orphelin_dir',
'alpha') ==
'confirmed')
928 } elseif ($result < 0)
print 'Error in '.get_class($object_instance).'.fetch of
id'.$id.' ref='.$ref.', result='.$result.'<br>';
936 if ($ok &&
GETPOST('clean_product_stock_batch', 'alpha'))
938 $methodtofix =
GETPOST(
'methodtofix',
'alpha') ?
GETPOST(
'methodtofix',
'alpha') :
'updatestock';
940 print '<tr><td colspan="2"><br>*** Clean table product_batch, methodtofix='.$methodtofix.
' (possible values: updatestock or updatebatch)</td></tr>';
942 $sql =
"SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
943 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p, ".MAIN_DB_PREFIX.
"product_stock as ps LEFT JOIN ".MAIN_DB_PREFIX.
"product_batch as pb ON ps.rowid = pb.fk_product_stock";
944 $sql .=
" WHERE p.rowid = ps.fk_product";
945 $sql .=
" AND p.tobatch = 1";
946 $sql .=
" GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
947 $sql .=
" HAVING reel != SUM(pb.qty) or SUM(pb.qty) IS NULL";
949 $resql = $db->query($sql);
952 $num = $db->num_rows(
$resql);
959 $obj = $db->fetch_object(
$resql);
960 print '<tr><td>Product '.$obj->rowid.
'-'.$obj->ref.
' in warehose '.$obj->fk_entrepot.
' -> '.$obj->psrowid.
': '.$obj->reel.
' (product_stock.reel) != '.($obj->reelbatch ? $obj->reelbatch :
'0').
' (sum product_batch)';
963 if ($obj->reel != $obj->reelbatch)
965 if ($methodtofix ==
'updatebatch')
968 print ' -> Insert qty '.($obj->reel - $obj->reelbatch).
' with lot 000000 linked to fk_product_stock='.$obj->psrowid;
969 if (
GETPOST(
'clean_product_stock_batch') ==
'confirmed')
971 $sql2 =
"INSERT INTO ".MAIN_DB_PREFIX.
"product_batch(fk_product_stock, batch, qty)";
972 $sql2 .=
"VALUES(".$obj->psrowid.
", '000000', ".($obj->reel - $obj->reelbatch).
")";
973 $resql2 = $db->query($sql2);
983 if ($methodtofix ==
'updatestock')
986 print ' -> Update qty of product_stock with qty = '.($obj->reelbatch ? $obj->reelbatch :
'0').
' for ps.rowid = '.$obj->psrowid;
987 if (
GETPOST(
'clean_product_stock_batch') ==
'confirmed')
993 $sql2 =
"UPDATE ".MAIN_DB_PREFIX.
"product_stock";
994 $sql2 .=
" SET reel = ".($obj->reelbatch ? $obj->reelbatch :
'0').
" WHERE rowid = ".$obj->psrowid;
995 $resql2 = $db->query($sql2);
999 $sql3 =
'UPDATE '.MAIN_DB_PREFIX.
'product p SET p.stock= (SELECT SUM(ps.reel) FROM '.MAIN_DB_PREFIX.
'product_stock ps WHERE ps.fk_product = p.rowid)';
1000 $resql3 = $db->query($sql3);
1011 if (!$error) $db->commit();
1012 else $db->rollback();
1022 print '<tr><td colspan="2">Nothing to do</td></tr>';
1031 if ($ok &&
GETPOST(
'clean_product_stock_negative_if_batch',
'alpha'))
1033 print '<tr><td colspan="2"><br>Clean table product_batch, methodtofix='.$methodtofix.
' (possible values: updatestock or updatebatch)</td></tr>';
1035 $sql =
"SELECT p.rowid, p.ref, p.tobatch, ps.rowid as psrowid, ps.fk_entrepot, ps.reel, SUM(pb.qty) as reelbatch";
1036 $sql .=
" FROM ".MAIN_DB_PREFIX.
"product as p, ".MAIN_DB_PREFIX.
"product_stock as ps, ".MAIN_DB_PREFIX.
"product_batch as pb";
1037 $sql .=
" WHERE p.rowid = ps.fk_product AND ps.rowid = pb.fk_product_stock";
1038 $sql .=
" AND p.tobatch = 1";
1039 $sql .=
" GROUP BY p.rowid, p.ref, p.tobatch, ps.rowid, ps.fk_entrepot, ps.reel";
1040 $sql .=
" HAVING reel != SUM(pb.qty)";
1041 $resql = $db->query($sql);
1044 $num = $db->num_rows(
$resql);
1051 $obj = $db->fetch_object(
$resql);
1052 print '<tr><td>'.$obj->rowid.
'-'.$obj->ref.
'-'.$obj->fk_entrepot.
' -> '.$obj->psrowid.
': '.$obj->reel.
' != '.$obj->reelbatch;
1061 if ($ok &&
GETPOST(
'set_empty_time_spent_amount',
'alpha'))
1063 print '<tr><td colspan="2"><br>*** Set value of time spent without amount</td></tr>';
1065 $sql =
"SELECT COUNT(ptt.rowid) as nb, u.rowid as user_id, u.login, u.thm as user_thm";
1066 $sql .=
" FROM ".MAIN_DB_PREFIX.
"projet_task_time as ptt, ".MAIN_DB_PREFIX.
"user as u";
1067 $sql .=
" WHERE ptt.fk_user = u.rowid";
1068 $sql .=
" AND ptt.thm IS NULL and u.thm > 0";
1069 $sql .=
" GROUP BY u.rowid, u.login, u.thm";
1071 $resql = $db->query($sql);
1074 $num = $db->num_rows(
$resql);
1081 $obj = $db->fetch_object(
$resql);
1082 print '<tr><td>'.$obj->login.
'-'.$obj->user_id.
' ('.$obj->nb.
' lines to fix) -> '.$obj->user_thm;
1086 if (
GETPOST(
'set_empty_time_spent_amount') ==
'confirmed')
1088 $sql2 =
"UPDATE ".MAIN_DB_PREFIX.
"projet_task_time";
1089 $sql2 .=
" SET thm = ".$obj->user_thm.
" WHERE thm IS NULL AND fk_user = ".$obj->user_id;
1090 $resql2 = $db->query($sql2);
1098 if (!$error) $db->commit();
1099 else $db->rollback();
1108 print '<tr><td>No time spent with empty line on users with a hourly rate defined</td></tr>';
1117 if ($ok &&
GETPOST(
'force_disable_of_modules_not_found',
'alpha'))
1119 print '<tr><td colspan="2"><br>*** Force modules not found physicaly to be disabled (only modules adding js, css or hooks can be detected as removed physicaly)</td></tr>';
1121 $arraylistofkey = array(
'hooks',
'js',
'css');
1123 foreach ($arraylistofkey as $key)
1125 $sql =
"SELECT DISTINCT name, value";
1126 $sql .=
" FROM ".MAIN_DB_PREFIX.
"const as c";
1127 $sql .=
" WHERE name LIKE 'MAIN_MODULE_%_".strtoupper($key).
"'";
1128 $sql .=
" ORDER BY name";
1130 $resql = $db->query($sql);
1133 $num = $db->num_rows(
$resql);
1139 $obj = $db->fetch_object(
$resql);
1140 $constantname = $obj->name;
1143 print $constantname;
1148 if (preg_match(
'/MAIN_MODULE_(.*)_'.strtoupper($key).
'/i', $constantname, $reg))
1150 $name = strtolower($reg[1]);
1157 if ($key ==
'hooks') $reloffile = $name.
'/class/actions_'.$name.
'.class.php';
1160 $value = $obj->value;
1161 $valuearray = json_decode($value);
1162 $reloffile = $valuearray[0];
1163 $reloffile = preg_replace(
'/^\//',
'', $valuearray[0]);
1167 $value = $obj->value;
1168 $valuearray = json_decode($value);
1169 if ($value && count($valuearray) == 0) $valuearray[0] = $value;
1170 $reloffile = preg_replace(
'/^\//',
'', $valuearray[0]);
1187 print ' - File of '.$key.
' ('.$reloffile.
') NOT found, we disable the module.';
1188 if (
GETPOST(
'force_disable_of_modules_not_found') ==
'confirmed')
1190 $sql2 =
"DELETE FROM ".MAIN_DB_PREFIX.
"const WHERE name = 'MAIN_MODULE_".strtoupper($name).
"_".strtoupper($key).
"'";
1191 $resql2 = $db->query($sql2);
1197 $sql3 =
"DELETE FROM ".MAIN_DB_PREFIX.
"const WHERE name = 'MAIN_MODULE_".strtoupper($name).
"'";
1198 $resql3 = $db->query($sql3);
1203 }
else print ' - <span class="warning">Cleaned</span>';
1205 print ' - <span class="warning">Canceled (test mode)</span>';
1208 print ' - File of '.$key.
' ('.$reloffile.
') found, we do nothing.';
1212 if (!$error) $db->commit();
1213 else $db->rollback();
1223 print '<tr><td>No active module with missing files found by searching on MAIN_MODULE_(.*)_'.strtoupper($key).
'</td></tr>';
1233 if ($ok &&
GETPOST(
'clean_perm_table',
'alpha'))
1235 print '<tr><td colspan="2"><br>*** Clean table user_rights from lines of external modules no more enabled</td></tr>';
1238 foreach ($conf->modules as $key => $val)
1240 $listofmods .= ($listofmods ?
',' :
'').
"'".$val.
"'";
1242 $sql =
'SELECT id, libelle as label, module from '.MAIN_DB_PREFIX.
'rights_def WHERE module not in ('.$listofmods.
') AND id > 100000';
1243 $resql = $db->query($sql);
1246 $num = $db->num_rows(
$resql);
1252 $obj = $db->fetch_object(
$resql);
1255 print '<tr><td>Found line with id '.$obj->id.
', label "'.$obj->label.
'" of module "'.$obj->module.
'" to delete';
1256 if (
GETPOST(
'clean_perm_table',
'alpha') ==
'confirmed')
1258 $sqldelete =
'DELETE FROM '.MAIN_DB_PREFIX.
'rights_def WHERE id = '.$obj->id;
1259 $resqldelete = $db->query($sqldelete);
1271 print '<tr><td>No lines of a disabled external module (with id > 100000) found into table rights_def</td></tr>';
1281 if ($ok &&
GETPOST(
'force_utf8_on_tables',
'alpha'))
1283 print '<tr><td colspan="2"><br>*** Force page code and collation of tables into utf8/utf8_unicode_ci (for mysql/mariadb only)</td></tr>';
1285 if ($db->type ==
"mysql" || $db->type ==
"mysqli")
1287 $force_utf8_on_tables =
GETPOST(
'force_utf8_on_tables',
'alpha');
1289 $listoftables = $db->DDLListTables($db->database_name);
1292 if ($force_utf8_on_tables ==
'confirmed')
1294 $sql =
'SET FOREIGN_KEY_CHECKS=0';
1295 print '<!-- '.$sql.
' -->';
1296 $resql = $db->query($sql);
1299 foreach ($listoftables as $table)
1302 if ($conf->db->dolibarr_main_db_encryption != 0 && preg_match(
'/\_const$/', $table))
continue;
1304 print '<tr><td colspan="2">';
1306 $sql =
'ALTER TABLE '.$table.
' CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci';
1307 print '<!-- '.$sql.
' -->';
1308 if ($force_utf8_on_tables ==
'confirmed')
1310 $resql = $db->query($sql);
1311 print ' - Done ('.($resql ?
'OK' :
'KO').
')';
1312 }
else print ' - Disabled';
1317 if ($force_utf8_on_tables ==
'confirmed')
1319 $sql =
'SET FOREIGN_KEY_CHECKS=1';
1320 print '<!-- '.$sql.
' -->';
1321 $resql = $db->query($sql);
1324 print '<tr><td colspan="2">Not available with database type '.$db->type.
'</td></tr>';
1329 if ($ok &&
GETPOST(
'repair_link_dispatch_lines_supplier_order_lines')) {
1353 $repair_link_dispatch_lines_supplier_order_lines =
GETPOST(
'repair_link_dispatch_lines_supplier_order_lines',
'alpha');
1356 echo
'<tr><th>Repair llx_commande_fournisseur_dispatch.fk_commandefourndet</th></tr>';
1357 echo
'<tr><td>Repair in progress. This may take a while.</td></tr>';
1359 $sql_dispatch =
'SELECT * FROM '.MAIN_DB_PREFIX.
'commande_fournisseur_dispatch WHERE COALESCE(fk_commandefourndet, 0) = 0';
1361 $resql_dispatch = $db->query($sql_dispatch);
1362 $n_processed_rows = 0;
1364 if ($resql_dispatch) {
1365 if ($db->num_rows($resql_dispatch) == 0) {
1366 echo
'<tr><td>Nothing to do.</td></tr>';
1369 while ($obj_dispatch = $db->fetch_object($resql_dispatch)) {
1370 $sql_line =
'SELECT line.rowid, line.qty FROM '.MAIN_DB_PREFIX.
'commande_fournisseurdet AS line';
1371 $sql_line .=
' WHERE line.fk_commande = '.$obj_dispatch->fk_commande;
1372 $sql_line .=
' AND line.fk_product = '.$obj_dispatch->fk_product;
1373 $resql_line = $db->query($sql_line);
1379 $remaining_qty = $obj_dispatch->qty;
1380 $first_iteration =
true;
1382 echo
'<tr><td>Unable to find a matching supplier order line for dispatch #'.$obj_dispatch->rowid.
'</td></tr>';
1383 $errors[] = $sql_line;
1384 $n_processed_rows++;
1387 if ($db->num_rows($resql_line) == 0)
continue;
1388 while ($obj_line = $db->fetch_object($resql_line)) {
1389 if (!$remaining_qty)
break;
1390 if (!$obj_line->rowid) {
1393 $qty_for_line = min($remaining_qty, $obj_line->qty);
1394 if ($first_iteration) {
1395 $sql_attach =
'UPDATE '.MAIN_DB_PREFIX.
'commande_fournisseur_dispatch';
1396 $sql_attach .=
' SET fk_commandefourndet = '.$obj_line->rowid.
', qty = '.$qty_for_line;
1397 $sql_attach .=
' WHERE rowid = '.$obj_dispatch->rowid;
1398 $first_iteration =
false;
1400 $sql_attach_values = array(
1401 $obj_dispatch->fk_commande,
1402 $obj_dispatch->fk_product,
1405 $obj_dispatch->fk_entrepot,
1406 $obj_dispatch->fk_user,
1407 $obj_dispatch->datec ?
'"'.$db->escape($obj_dispatch->datec).
'"' :
'NULL',
1408 $obj_dispatch->comment ?
'"'.$db->escape($obj_dispatch->comment).
'"' :
'NULL',
1409 $obj_dispatch->status ?:
'NULL',
1410 $obj_dispatch->tms ?
'"'.$db->escape($obj_dispatch->tms).
'"' :
'NULL',
1411 $obj_dispatch->batch ?:
'NULL',
1412 $obj_dispatch->eatby ?
'"'.$db->escape($obj_dispatch->eatby).
'"' :
'NULL',
1413 $obj_dispatch->sellby ?
'"'.$db->escape($obj_dispatch->sellby).
'"' :
'NULL'
1415 $sql_attach_values = join(
', ', $sql_attach_values);
1417 $sql_attach =
'INSERT INTO '.MAIN_DB_PREFIX.
'commande_fournisseur_dispatch';
1418 $sql_attach .=
' (fk_commande, fk_product, fk_commandefourndet, qty, fk_entrepot, fk_user, datec, comment, status, tms, batch, eatby, sellby)';
1419 $sql_attach .=
' VALUES ('.$sql_attach_values.
')';
1422 if ($repair_link_dispatch_lines_supplier_order_lines ==
'confirmed')
1424 $resql_attach = $db->query($sql_attach);
1426 $resql_attach =
true;
1429 if ($resql_attach) {
1430 $remaining_qty -= $qty_for_line;
1432 $errors[] = $sql_attach;
1435 $first_iteration =
false;
1437 $n_processed_rows++;
1440 if (!($n_processed_rows & 0xff)) {
1441 echo
'<tr><td>Processed '.$n_processed_rows.
' rows with '.count($errors).
' errors…'.
"</td></tr>\n";
1447 echo
'<tr><td>Unable to find any dispatch without an fk_commandefourndet.'.
"</td></tr>\n";
1448 echo $sql_dispatch.
"\n";
1450 echo
'<tr><td>Fixed '.$n_processed_rows.
' rows with '.count($errors).
' errors…'.
"</td></tr>\n";
1451 echo
'<tr><td>DONE.'.
"</td></tr>\n";
1453 if (count($errors)) {
1455 echo
'<tr><td>The transaction was rolled back due to errors: nothing was changed by the script.</td></tr>';
1461 echo
'<tr><td><h3>SQL queries with errors:</h3></tr></td>';
1462 echo
'<tr><td>'.join(
'</td></tr><tr><td>', $errors).
'</td></tr>';
1469 if (empty($actiondone))
1471 print '<div class="error">'.$langs->trans(
"ErrorWrongParameters").
'</div>';
1476 print '<div class="center" style="padding-top: 10px"><a href="../index.php?mainmenu=home&leftmenu=home'.(GETPOSTISSET(
"login") ?
'&username='.urlencode(
GETPOST(
"login")) :
'').
'">';
1477 print $langs->trans(
"GoToDolibarr");
1480 print '<div class="center warning" style="padding-top: 10px">';
1481 print $langs->trans(
"SetAtLeastOneOptionAsUrlParameter");
1488 if ($db->connected) $db->close();
1491 if (!$ok && isset($argv[1])) exit(1);
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
Copy a file to another file.
vignette($file, $maxWidth=160, $maxHeight=120, $extName= '_small', $quality=50, $outdir= 'thumbs', $targetformat=0)
Create a thumbnail from an image file (Supported extensions are gif, jpg, png and bmp)...
pHeader($subtitle, $next, $action= 'set', $param= '', $forcejqueryurl= '', $csstable= 'main-inside')
Show HTML header of install pages.
getDoliDBInstance($type, $host, $user, $pass, $name, $port)
Return a DoliDB instance (database handler).
dol_decode($chain, $key= '1')
Decode a base 64 encoded + specific delta change.
clean_data_ecm_directories()
Clean data into ecm_directories table.
Class to manage contracts.
Class to manage suppliers invoices.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
image_format_supported($file, $acceptsvg=0)
Return if a filename is file name of a supported image format.
dolibarr_install_syslog($message, $level=LOG_DEBUG)
Log function for install pages.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_strlen($string, $stringencoding= 'UTF-8')
Make a strlen call.
Class to manage customers orders.
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1)
Remove a file or several files with a mask.
run_sql($sqlfile, $silent=1, $entity= '', $usesavepoint=1, $handler= '', $okerror= 'default', $linelengthlimit=32768, $nocommentremoval=0, $offsetforchartofaccount=0)
Launch a sql file.
dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0)
Scan a directory and return a list of files/directories.
Class to manage predefined suppliers products.
dol_is_file($pathoffile)
Return if path is a file.
pFooter($nonext=0, $setuplang= '', $jscheckfunction= '', $withpleasewait=0)
Print HTML footer of install pages.
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...
Class to manage invoices.
dol_delete_dir($dir, $nophperrors=0)
Remove a directory (not recursive, so content must be empty).
Classe permettant la gestion des paiements des charges La tva collectee n'est calculee que sur les fa...
if(!defined('CSRFCHECK_WITH_TOKEN')) define('CSRFCHECK_WITH_TOKEN'
Draft customers invoices.
Class to manage proposals.
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)