Fix: Pb into repair function
This commit is contained in:
parent
74cba062b4
commit
f6445f9cef
@ -132,7 +132,7 @@ if ($ok)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche version
|
// Show database version
|
||||||
if ($ok)
|
if ($ok)
|
||||||
{
|
{
|
||||||
$version=$db->getVersion();
|
$version=$db->getVersion();
|
||||||
@ -143,12 +143,15 @@ if ($ok)
|
|||||||
//print '<td align="right">'.join('.',$versionarray).'</td></tr>';
|
//print '<td align="right">'.join('.',$versionarray).'</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force l'affichage de la progression
|
// Show wait message
|
||||||
print '<tr><td colspan="2">'.$langs->trans("PleaseBePatient").'</td></tr>';
|
print '<tr><td colspan="2">'.$langs->trans("PleaseBePatient").'</td></tr>';
|
||||||
flush();
|
flush();
|
||||||
|
|
||||||
|
|
||||||
// Run repair SQL file
|
/* Start action here */
|
||||||
|
|
||||||
|
|
||||||
|
// run_sql: Run repair SQL file
|
||||||
if ($ok)
|
if ($ok)
|
||||||
{
|
{
|
||||||
$dir = "mysql/migration/";
|
$dir = "mysql/migration/";
|
||||||
@ -191,7 +194,9 @@ if ($ok)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Search list of fields declared and list of fields created into databases and create fields missing
|
// sync_extrafields: Search list of fields declared and list of fields created into databases and create fields missing
|
||||||
|
if ($ok)
|
||||||
|
{
|
||||||
$extrafields=new ExtraFields($db);
|
$extrafields=new ExtraFields($db);
|
||||||
$listofmodulesextra=array('societe'=>'societe','adherent'=>'adherent','product'=>'product',
|
$listofmodulesextra=array('societe'=>'societe','adherent'=>'adherent','product'=>'product',
|
||||||
'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture',
|
'socpeople'=>'socpeople', 'commande'=>'commande', 'facture'=>'facture',
|
||||||
@ -263,14 +268,95 @@ foreach($listofmodulesextra as $tablename => $elementtype)
|
|||||||
print "</td><td> </td></tr>\n";
|
print "</td><td> </td></tr>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Clean data into ecm_directories table
|
|
||||||
|
// clean_data_ecm_dir: Clean data into ecm_directories table
|
||||||
|
if ($ok)
|
||||||
|
{
|
||||||
clean_data_ecm_directories();
|
clean_data_ecm_directories();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Check and clean linked elements
|
|
||||||
if (GETPOST('clean_linked_elements'))
|
/* From here, actions need a parameter */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// clean_linked_elements: Check and clean linked elements
|
||||||
|
if ($ok && GETPOST('restore_thirdparties_logos'))
|
||||||
|
{
|
||||||
|
//$exts=array('gif','png','jpg');
|
||||||
|
|
||||||
|
$ext='';
|
||||||
|
//foreach($exts as $ext)
|
||||||
|
//{
|
||||||
|
$sql="SELECT s.rowid, s.nom as name, s.logo FROM ".MAIN_DB_PREFIX."societe as s ORDER BY s.nom";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num=$db->num_rows($resql);
|
||||||
|
$i=0;
|
||||||
|
|
||||||
|
while($i < $num)
|
||||||
|
{
|
||||||
|
$obj=$db->fetch_object($resql);
|
||||||
|
|
||||||
|
/*
|
||||||
|
$name=preg_replace('/é/','',$obj->name);
|
||||||
|
$name=preg_replace('/ /','_',$name);
|
||||||
|
$name=preg_replace('/\'/','',$name);
|
||||||
|
*/
|
||||||
|
|
||||||
|
$tmp=explode('.',$obj->logo);
|
||||||
|
$name=$tmp[0];
|
||||||
|
if (isset($tmp[1])) $ext='.'.$tmp[1];
|
||||||
|
|
||||||
|
if (! empty($name))
|
||||||
|
{
|
||||||
|
$filetotest=$dolibarr_main_data_root.'/societe/logos/'.$name.$ext;
|
||||||
|
$filetotestsmall=$dolibarr_main_data_root.'/societe/logos/thumbs/'.$name.$ext;
|
||||||
|
$exists=dol_is_file($filetotest);
|
||||||
|
print 'Check thirdparty '.$obj->rowid.' name='.$obj->name.' logo='.$obj->logo.' file '.$filetotest." exists=".$exists."<br>\n";
|
||||||
|
if ($exists)
|
||||||
|
{
|
||||||
|
$filetarget=$dolibarr_main_data_root.'/societe/'.$obj->rowid.'/logos/'.$name.$ext;
|
||||||
|
$filetargetsmall=$dolibarr_main_data_root.'/societe/'.$obj->rowid.'/logos/thumbs/'.$name.'_small'.$ext;
|
||||||
|
$existt=dol_is_file($filetarget);
|
||||||
|
if (! $existt)
|
||||||
|
{
|
||||||
|
dol_mkdir($dolibarr_main_data_root.'/societe/'.$obj->rowid.'/logos');
|
||||||
|
|
||||||
|
print " -> Copy file ".$filetotest." -> ".$filetarget."<br>\n";
|
||||||
|
dol_copy($filetotest, $filetarget, '', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$existtt=dol_is_file($filetargetsmall);
|
||||||
|
if (! $existtt)
|
||||||
|
{
|
||||||
|
dol_mkdir($dolibarr_main_data_root.'/societe/'.$obj->rowid.'/logos/thumbs');
|
||||||
|
|
||||||
|
print " -> Copy file ".$filetotestsmall." -> ".$filetargetsmall."<br>\n";
|
||||||
|
dol_copy($filetotestsmall, $filetargetsmall, '', 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ok=0;
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// clean_linked_elements: Check and clean linked elements
|
||||||
|
if ($ok && GETPOST('clean_linked_elements'))
|
||||||
{
|
{
|
||||||
// propal => order
|
// propal => order
|
||||||
print "</td><td>".checkLinkedElements('propal', 'commande')."</td></tr>\n";
|
print "</td><td>".checkLinkedElements('propal', 'commande')."</td></tr>\n";
|
||||||
@ -292,8 +378,8 @@ if (GETPOST('clean_linked_elements'))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Run purge of directory
|
// clean_orphelin_dir: Run purge of directory
|
||||||
if (GETPOST('purge'))
|
if ($ok && GETPOST('clean_orphelin_dir'))
|
||||||
{
|
{
|
||||||
$conf->setValues($db);
|
$conf->setValues($db);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user