Move/Rename numbering module files for invoices to normalize code.
This commit is contained in:
parent
757ddf44d6
commit
4c73cb64c8
@ -102,7 +102,7 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0)
|
|||||||
$result=$facture->create($user);
|
$result=$facture->create($user);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
$result=$facture->set_valid($user,$socid);
|
$result=$facture->validate($user);
|
||||||
if ($result)
|
if ($result)
|
||||||
{
|
{
|
||||||
$nbp = rand(2, 5);
|
$nbp = rand(2, 5);
|
||||||
|
|||||||
@ -241,15 +241,22 @@ foreach ($conf->file->dol_document_root as $dirroot)
|
|||||||
{
|
{
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
if (is_dir($dir.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS')
|
if (! is_dir($dir.$file) || (substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS'))
|
||||||
{
|
{
|
||||||
$filebis = $file."/".$file.".modules.php";
|
$filebis = $file;
|
||||||
|
$classname = preg_replace('/\.php$/','',$file);
|
||||||
if (is_readable($dir.$filebis))
|
// For compatibility
|
||||||
|
if (! is_file($dir.$filebis))
|
||||||
|
{
|
||||||
|
$filebis = $file."/".$file.".modules.php";
|
||||||
|
$classname = "mod_facture_".$file;
|
||||||
|
}
|
||||||
|
//print "x".$dir."-".$filebis."-".$classname;
|
||||||
|
if (! class_exists($classname) && is_readable($dir.$filebis) && (preg_match('/mod_/',$filebis) || preg_match('/mod_/',$classname)) && substr($filebis, strlen($filebis)-3, 3) == 'php')
|
||||||
{
|
{
|
||||||
// Chargement de la classe de numerotation
|
// Chargement de la classe de numerotation
|
||||||
require_once($dir.$filebis);
|
require_once($dir.$filebis);
|
||||||
$classname = "mod_facture_".$file;
|
|
||||||
$module = new $classname($db);
|
$module = new $classname($db);
|
||||||
|
|
||||||
// Show modules according to features level
|
// Show modules according to features level
|
||||||
@ -260,7 +267,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
|
|||||||
{
|
{
|
||||||
$var = !$var;
|
$var = !$var;
|
||||||
print '<tr '.$bc[$var].'><td width="100">';
|
print '<tr '.$bc[$var].'><td width="100">';
|
||||||
echo "$file";
|
echo preg_replace('/mod_facture_/','',preg_replace('/\.php$/','',$file));
|
||||||
print "</td><td>\n";
|
print "</td><td>\n";
|
||||||
|
|
||||||
print $module->info();
|
print $module->info();
|
||||||
@ -271,13 +278,14 @@ foreach ($conf->file->dol_document_root as $dirroot)
|
|||||||
print '<td nowrap="nowrap">'.$module->getExample().'</td>';
|
print '<td nowrap="nowrap">'.$module->getExample().'</td>';
|
||||||
|
|
||||||
print '<td align="center">';
|
print '<td align="center">';
|
||||||
if ($conf->global->FACTURE_ADDON == "$file")
|
//print "> ".$conf->global->FACTURE_ADDON." - ".$file;
|
||||||
|
if ($conf->global->FACTURE_ADDON == $file || $conf->global->FACTURE_ADDON.'.php' == $file)
|
||||||
{
|
{
|
||||||
print img_picto($langs->trans("Activated"),'on');
|
print img_picto($langs->trans("Activated"),'on');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.preg_replace('/\.php$/','',$file).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||||
}
|
}
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
|
|||||||
@ -213,7 +213,7 @@ switch ( $_GET['action'] )
|
|||||||
$resultcreate=$invoice->create($user,0,dol_stringtotime($obj_facturation->paiement_le()));
|
$resultcreate=$invoice->create($user,0,dol_stringtotime($obj_facturation->paiement_le()));
|
||||||
if ($resultcreate > 0)
|
if ($resultcreate > 0)
|
||||||
{
|
{
|
||||||
$resultvalid=$invoice->set_valid($user,$conf_fksoc,$obj_facturation->num_facture());
|
$resultvalid=$invoice->validate($user,$obj_facturation->num_facture());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -227,7 +227,7 @@ switch ( $_GET['action'] )
|
|||||||
$resultcreate=$invoice->create($user,0,0);
|
$resultcreate=$invoice->create($user,0,0);
|
||||||
if ($resultcreate > 0)
|
if ($resultcreate > 0)
|
||||||
{
|
{
|
||||||
$resultvalid=$invoice->set_valid($user,$conf_fksoc,$obj_facturation->num_facture());
|
$resultvalid=$invoice->validate($user,$obj_facturation->num_facture());
|
||||||
|
|
||||||
$id = $invoice->id;
|
$id = $invoice->id;
|
||||||
|
|
||||||
|
|||||||
@ -310,7 +310,7 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
|
|||||||
$fac->fetch($_GET['facid']);
|
$fac->fetch($_GET['facid']);
|
||||||
$fac->fetch_client();
|
$fac->fetch_client();
|
||||||
|
|
||||||
$result = $fac->set_valid($user);
|
$result = $fac->validate($user);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
// Define output language
|
// Define output language
|
||||||
|
|||||||
@ -1294,11 +1294,10 @@ class Facture extends CommonObject
|
|||||||
/**
|
/**
|
||||||
* \brief Tag la facture comme validee + appel trigger BILL_VALIDATE
|
* \brief Tag la facture comme validee + appel trigger BILL_VALIDATE
|
||||||
* \param user Utilisateur qui valide la facture
|
* \param user Utilisateur qui valide la facture
|
||||||
* \param soc Ne sert plus. \\TODO A virer
|
|
||||||
* \param force_number Reference a forcer de la facture
|
* \param force_number Reference a forcer de la facture
|
||||||
* \return int <0 si ko, >0 si ok
|
* \return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function set_valid($user, $soc='', $force_number='')
|
function validate($user, $force_number='')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -1307,14 +1306,14 @@ class Facture extends CommonObject
|
|||||||
// Protection
|
// Protection
|
||||||
if (! $this->brouillon)
|
if (! $this->brouillon)
|
||||||
{
|
{
|
||||||
dol_syslog("Facture::set_valid no draft status", LOG_WARNING);
|
dol_syslog("Facture::validate no draft status", LOG_WARNING);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $user->rights->facture->valider)
|
if (! $user->rights->facture->valider)
|
||||||
{
|
{
|
||||||
$this->error='Permission denied';
|
$this->error='Permission denied';
|
||||||
dol_syslog("Facture::set_valid ".$this->error, LOG_ERR);
|
dol_syslog("Facture::validate ".$this->error, LOG_ERR);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1397,11 +1396,11 @@ class Facture extends CommonObject
|
|||||||
}
|
}
|
||||||
$sql.= ' WHERE rowid = '.$this->id;
|
$sql.= ' WHERE rowid = '.$this->id;
|
||||||
|
|
||||||
dol_syslog("Facture::set_valid sql=".$sql);
|
dol_syslog("Facture::validate sql=".$sql);
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
{
|
{
|
||||||
dol_syslog("Facture::set_valid Echec update - 10 - sql=".$sql, LOG_ERR);
|
dol_syslog("Facture::validate Echec update - 10 - sql=".$sql, LOG_ERR);
|
||||||
dol_print_error($this->db);
|
dol_print_error($this->db);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -1450,7 +1449,7 @@ class Facture extends CommonObject
|
|||||||
$dirdest = $conf->facture->dir_output.'/'.$snumfa;
|
$dirdest = $conf->facture->dir_output.'/'.$snumfa;
|
||||||
if (file_exists($dirsource))
|
if (file_exists($dirsource))
|
||||||
{
|
{
|
||||||
dol_syslog("Facture::set_valid rename dir ".$dirsource." into ".$dirdest);
|
dol_syslog("Facture::validate rename dir ".$dirsource." into ".$dirdest);
|
||||||
|
|
||||||
if (@rename($dirsource, $dirdest))
|
if (@rename($dirsource, $dirdest))
|
||||||
{
|
{
|
||||||
@ -2238,20 +2237,36 @@ class Facture extends CommonObject
|
|||||||
|
|
||||||
if (empty($conf->global->FACTURE_ADDON))
|
if (empty($conf->global->FACTURE_ADDON))
|
||||||
{
|
{
|
||||||
$conf->global->FACTURE_ADDON='terre';
|
$conf->global->FACTURE_ADDON='mod_facture_terre';
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = $conf->global->FACTURE_ADDON."/".$conf->global->FACTURE_ADDON.".modules.php";
|
|
||||||
$classname = "mod_facture_".$conf->global->FACTURE_ADDON;
|
|
||||||
|
|
||||||
// Include file with class
|
|
||||||
$mybool=false;
|
$mybool=false;
|
||||||
|
|
||||||
|
$file = $conf->global->FACTURE_ADDON.".php";
|
||||||
|
$classname = $conf->global->FACTURE_ADDON;
|
||||||
|
// Include file with class
|
||||||
foreach ($conf->file->dol_document_root as $dirroot)
|
foreach ($conf->file->dol_document_root as $dirroot)
|
||||||
{
|
{
|
||||||
$dir = $dirroot."/includes/modules/facture/";
|
$dir = $dirroot."/includes/modules/facture/";
|
||||||
// Load file with numbering class (if found)
|
// Load file with numbering class (if found)
|
||||||
$mybool|=@include_once($dir.$file);
|
$mybool|=@include_once($dir.$file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For compatibility
|
||||||
|
if (! $mybool)
|
||||||
|
{
|
||||||
|
$file = $conf->global->FACTURE_ADDON."/".$conf->global->FACTURE_ADDON.".modules.php";
|
||||||
|
$classname = "mod_facture_".$conf->global->FACTURE_ADDON;
|
||||||
|
// Include file with class
|
||||||
|
foreach ($conf->file->dol_document_root as $dirroot)
|
||||||
|
{
|
||||||
|
$dir = $dirroot."/includes/modules/facture/";
|
||||||
|
// Load file with numbering class (if found)
|
||||||
|
$mybool|=@include_once($dir.$file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//print "xx".$mybool.$dir.$file."-".$classname;
|
||||||
|
|
||||||
if (! $mybool) dol_print_error('',"Failed to include file ".$file);
|
if (! $mybool) dol_print_error('',"Failed to include file ".$file);
|
||||||
|
|
||||||
$obj = new $classname();
|
$obj = new $classname();
|
||||||
|
|||||||
@ -563,7 +563,7 @@ class FactureFournisseur extends Facture
|
|||||||
* \param user Object user
|
* \param user Object user
|
||||||
* \return int <0 if KO, =0 if nothing to do, >0 if OK
|
* \return int <0 if KO, =0 if nothing to do, >0 if OK
|
||||||
*/
|
*/
|
||||||
function set_valid($user)
|
function validate($user)
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
@ -572,7 +572,7 @@ class FactureFournisseur extends Facture
|
|||||||
// Protection
|
// Protection
|
||||||
if ($this->statut > 0) // This is to avoid to validate twice (avoid errors on logs and stock management)
|
if ($this->statut > 0) // This is to avoid to validate twice (avoid errors on logs and stock management)
|
||||||
{
|
{
|
||||||
dol_syslog("FactureFournisseur::set_valid no draft status", LOG_WARNING);
|
dol_syslog("FactureFournisseur::validate no draft status", LOG_WARNING);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -582,7 +582,7 @@ class FactureFournisseur extends Facture
|
|||||||
$sql.= " SET fk_statut = 1, fk_user_valid = ".$user->id;
|
$sql.= " SET fk_statut = 1, fk_user_valid = ".$user->id;
|
||||||
$sql.= " WHERE rowid = ".$this->id;
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
dol_syslog("FactureFournisseur::set_valid sql=".$sql);
|
dol_syslog("FactureFournisseur::validate sql=".$sql);
|
||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -94,7 +94,7 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
|
|||||||
{
|
{
|
||||||
$facturefourn=new FactureFournisseur($db);
|
$facturefourn=new FactureFournisseur($db);
|
||||||
$facturefourn->fetch($_GET['facid']);
|
$facturefourn->fetch($_GET['facid']);
|
||||||
$result = $facturefourn->set_valid($user);
|
$result = $facturefourn->validate($user);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes')
|
||||||
|
|||||||
166
htdocs/includes/modules/facture/mod_facture_terre.php
Normal file
166
htdocs/includes/modules/facture/mod_facture_terre.php
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/includes/modules/facture/terre/terre.modules.php
|
||||||
|
* \ingroup facture
|
||||||
|
* \brief File containing class for numbering module Terre
|
||||||
|
* \version $Id$
|
||||||
|
*/
|
||||||
|
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/facture/modules_facture.php");
|
||||||
|
|
||||||
|
/** \class mod_facture_terre
|
||||||
|
* \brief Classe du modele de numerotation de reference de facture Terre
|
||||||
|
*/
|
||||||
|
class mod_facture_terre extends ModeleNumRefFactures
|
||||||
|
{
|
||||||
|
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||||
|
var $prefixinvoice='FA';
|
||||||
|
var $prefixcreditnote='AV';
|
||||||
|
var $error='';
|
||||||
|
|
||||||
|
/** \brief Renvoi la description du modele de numerotation
|
||||||
|
* \return string Texte descripif
|
||||||
|
*/
|
||||||
|
function info()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
|
return $langs->trans('TerreNumRefModelDesc1',$this->prefixinvoice,$this->prefixcreditnote);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Renvoi un exemple de numerotation
|
||||||
|
* \return string Example
|
||||||
|
*/
|
||||||
|
function getExample()
|
||||||
|
{
|
||||||
|
return $this->prefixinvoice."0501-0001";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Test si les numeros deja en vigueur dans la base ne provoquent pas de
|
||||||
|
* de conflits qui empechera cette num<EFBFBD>rotation de fonctionner.
|
||||||
|
* \return boolean false si conflit, true si ok
|
||||||
|
*/
|
||||||
|
function canBeActivated()
|
||||||
|
{
|
||||||
|
global $langs,$conf;
|
||||||
|
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
|
// Check invoice num
|
||||||
|
$fayymm='';
|
||||||
|
|
||||||
|
$sql = "SELECT MAX(facnumber)";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
|
$sql.= " WHERE facnumber like '".$this->prefixinvoice."%'";
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
if ($row) $fayymm = substr($row[0],0,6);
|
||||||
|
}
|
||||||
|
if ($fayymm && ! preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i',$fayymm))
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans('TerreNumRefModelError');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check credit note num
|
||||||
|
$fayymm='';
|
||||||
|
|
||||||
|
$sql = "SELECT MAX(facnumber)";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
|
$sql.= " WHERE facnumber like '".$this->prefixcreditnote."%'";
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
if ($row) $fayymm = substr($row[0],0,6);
|
||||||
|
}
|
||||||
|
if ($fayymm && ! preg_match('/'.$this->prefixcreditnote.'[0-9][0-9][0-9][0-9]/i',$fayymm))
|
||||||
|
{
|
||||||
|
$this->error=$langs->trans('TerreNumRefModelError');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Renvoi prochaine valeur attribuee
|
||||||
|
* \param objsoc Objet societe
|
||||||
|
* \param facture Objet facture
|
||||||
|
* \return string Valeur
|
||||||
|
*/
|
||||||
|
function getNextValue($objsoc,$facture)
|
||||||
|
{
|
||||||
|
global $db,$conf;
|
||||||
|
|
||||||
|
if ($facture->type == 2) $prefix=$this->prefixcreditnote;
|
||||||
|
else $prefix=$this->prefixinvoice;
|
||||||
|
|
||||||
|
// D'abord on recupere la valeur max (reponse immediate car champ ind<6E>x<EFBFBD>)
|
||||||
|
$posindice=8;
|
||||||
|
|
||||||
|
$sql = "SELECT MAX(SUBSTRING(facnumber,".$posindice.")) as max";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
|
||||||
|
$sql.= " WHERE facnumber like '".$prefix."%'";
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
dol_syslog("mod_facture_terre::getNextValue sql=".$sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
if ($obj) $max = intval($obj->max);
|
||||||
|
else $max=0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog("mod_facture_terre::getNextValue sql=".$sql, LOG_ERR);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$date=$facture->date; // This is invoice date (not creation date)
|
||||||
|
$yymm = strftime("%y%m",$date);
|
||||||
|
$num = sprintf("%04s",$max+1);
|
||||||
|
|
||||||
|
dol_syslog("mod_facture_terre::getNextValue return ".$prefix.$yymm."-".$num);
|
||||||
|
return $prefix.$yymm."-".$num;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** \brief Return next free value
|
||||||
|
* \param objsoc Object third party
|
||||||
|
* \param objforref Object for number to search
|
||||||
|
* \return string Next free value
|
||||||
|
*/
|
||||||
|
function getNumRef($objsoc,$objforref)
|
||||||
|
{
|
||||||
|
return $this->getNextValue($objsoc,$objforref);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@ -214,8 +214,6 @@ if (isset($_POST['action']) && preg_match('/upgrade/i',$_POST["action"]))
|
|||||||
|
|
||||||
migrate_links_transfert($db,$langs,$conf);
|
migrate_links_transfert($db,$langs,$conf);
|
||||||
|
|
||||||
migrate_delete_old_files($db,$langs,$conf);
|
|
||||||
|
|
||||||
|
|
||||||
// Script pour V2.2 -> V2.4
|
// Script pour V2.2 -> V2.4
|
||||||
migrate_commande_expedition($db,$langs,$conf);
|
migrate_commande_expedition($db,$langs,$conf);
|
||||||
@ -290,6 +288,11 @@ if (isset($_POST['action']) && preg_match('/upgrade/i',$_POST["action"]))
|
|||||||
// La procedure etant concue pour pouvoir passer plusieurs fois quelquesoit la situation.
|
// La procedure etant concue pour pouvoir passer plusieurs fois quelquesoit la situation.
|
||||||
$db->commit();
|
$db->commit();
|
||||||
$db->close();
|
$db->close();
|
||||||
|
|
||||||
|
// Actions for all version (not in database)
|
||||||
|
migrate_delete_old_files($db,$langs,$conf);
|
||||||
|
|
||||||
|
migrate_delete_old_dir($db,$langs,$conf);
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
@ -1744,6 +1747,39 @@ function migrate_delete_old_files($db,$langs,$conf)
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Remove deprecated directories
|
||||||
|
*/
|
||||||
|
function migrate_delete_old_dir($db,$langs,$conf)
|
||||||
|
{
|
||||||
|
$result=true;
|
||||||
|
|
||||||
|
dolibarr_install_syslog("upgrade2::migrate_delete_old_dir");
|
||||||
|
|
||||||
|
// List of files to delete
|
||||||
|
$filetodeletearray=array(
|
||||||
|
DOL_DOCUMENT_ROOT.'/includes/modules/facture/terre',
|
||||||
|
DOL_DOCUMENT_ROOT.'/includes/modules/facture/mercure'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($filetodeletearray as $filetodelete)
|
||||||
|
{
|
||||||
|
//print '<b>'.$filetodelete."</b><br>\n";
|
||||||
|
if (file_exists($filetodelete))
|
||||||
|
{
|
||||||
|
$result=dol_delete_dir_recursive($filetodelete);
|
||||||
|
}
|
||||||
|
if (! $result)
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
print '<div class="error">'.$langs->trans("Error").': '.$langs->trans("ErrorFailToDeleteDir",$filetodelete);
|
||||||
|
print ' '.$langs->trans("RemoveItManuallyAndPressF5ToContinue").'</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Disable/Reenable features modules.
|
* Disable/Reenable features modules.
|
||||||
* We must do this when internal menu of module or permissions has changed
|
* We must do this when internal menu of module or permissions has changed
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user