New: Allow to use ODT templates for prososal like it's done for invoices
This commit is contained in:
parent
0e827b7c20
commit
2093b3f0be
@ -334,11 +334,11 @@ print '</table><br>';
|
||||
|
||||
|
||||
/*
|
||||
* Modeles de documents
|
||||
* Document templates generators
|
||||
*/
|
||||
print_titre($langs->trans("OrdersModelModule"));
|
||||
|
||||
// Defini tableau def de modele
|
||||
// Load array def with activated templates
|
||||
$type='order';
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
@ -365,12 +365,11 @@ else
|
||||
|
||||
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||
print "<tr class=\"liste_titre\">\n";
|
||||
print ' <td width="100">'.$langs->trans("Name")."</td>\n";
|
||||
print " <td>".$langs->trans("Description")."</td>\n";
|
||||
print '<td align="center" width="40">'.$langs->trans("Status")."</td>\n";
|
||||
print '<td align="center" width="40">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td align="center" width="40">'.$langs->trans("Infos").'</td>';
|
||||
print '<td align="center" width="40">'.$langs->trans("Preview").'</td>';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td align="center" width="38" colspan="2">'.$langs->trans("Infos").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
@ -387,11 +386,13 @@ foreach ($conf->file->dol_document_root as $dirroot)
|
||||
$handle=opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
$filelist[]=$file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
{
|
||||
|
||||
@ -439,10 +439,11 @@ print '<br>';
|
||||
print_titre($langs->trans("BillsPDFModules"));
|
||||
|
||||
// Load array def with activated templates
|
||||
$type='invoice';
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||
$sql.= " WHERE type = 'invoice'";
|
||||
$sql.= " WHERE type = '".$type."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
@ -472,7 +473,6 @@ print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
|
||||
$var=true;
|
||||
foreach ($conf->file->dol_document_root as $dirroot)
|
||||
{
|
||||
@ -490,6 +490,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
|
||||
$filelist[]=$file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
{
|
||||
|
||||
@ -472,7 +472,7 @@ dol_fiche_end();
|
||||
print '<div class="tabsAction">';
|
||||
print '</div>';
|
||||
|
||||
$db->close();
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
?>
|
||||
|
||||
@ -422,6 +422,7 @@ foreach ($conf->file->dol_document_root as $dirroot)
|
||||
$filelist[]=$file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach($filelist as $file)
|
||||
{
|
||||
|
||||
@ -422,33 +422,48 @@ function dol_filemtime($pathoffile)
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy a file to another file
|
||||
* Copy a file to another file.
|
||||
*
|
||||
* @param string $srcfile Source file (can't be a directory)
|
||||
* @param string $destfile Destination file (can't be a directory)
|
||||
* @param int $newmask Mask for new file (0 by default means $conf->global->MAIN_UMASK)
|
||||
* @param int $overwriteifexists Overwrite file if exists (1 by default)
|
||||
* @return boolean True if OK, false if KO
|
||||
* @return int <0 if error, 0 if nothing done (dest file already exists and overwriteifexists=0), >0 if OK
|
||||
*/
|
||||
function dol_copy($srcfile, $destfile, $newmask=0, $overwriteifexists=1)
|
||||
{
|
||||
global $conf;
|
||||
$result=false;
|
||||
|
||||
dol_syslog("files.lib.php::dol_copy srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwritifexists=".$overwriteifexists);
|
||||
if ($overwriteifexists || ! dol_is_file($destfile))
|
||||
$destexists=dol_is_file($destfile);
|
||||
if (! $overwriteifexists && $destexists) return 0;
|
||||
|
||||
$newpathofsrcfile=dol_osencode($srcfile);
|
||||
$newpathofdestfile=dol_osencode($destfile);
|
||||
$newdirdestfile=dirname($newpathofdestfile);
|
||||
|
||||
if ($destexists && ! is_writable($newpathofdestfile))
|
||||
{
|
||||
dol_syslog("files.lib.php::dol_copy failed Permission denied to overwrite target file", LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
if (! is_writable($newdirdestfile))
|
||||
{
|
||||
dol_syslog("files.lib.php::dol_copy failed Permission denied to write into target directory ".$newdirdestfile, LOG_WARNING);
|
||||
return -2;
|
||||
}
|
||||
// Copy with overwriting if exists
|
||||
$result=@copy($newpathofsrcfile, $newpathofdestfile);
|
||||
//$result=copy($newpathofsrcfile, $newpathofdestfile); // To see errors, remove @
|
||||
if (! $result)
|
||||
{
|
||||
$newpathofsrcfile=dol_osencode($srcfile);
|
||||
$newpathofdestfile=dol_osencode($destfile);
|
||||
|
||||
$result=@copy($newpathofsrcfile, $newpathofdestfile);
|
||||
//$result=copy($srcfile, $destfile); // To see errors, remove @
|
||||
if (! $result) dol_syslog("files.lib.php::dol_copy failed", LOG_WARNING);
|
||||
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
dol_syslog("files.lib.php::dol_copy failed to copy", LOG_WARNING);
|
||||
return -3;
|
||||
}
|
||||
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $newmask=$conf->global->MAIN_UMASK;
|
||||
@chmod($newpathofdestfile, octdec($newmask));
|
||||
|
||||
return $result;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -98,41 +98,38 @@ abstract class DolibarrModules
|
||||
// Create module's directories
|
||||
if (! $err) $err+=$this->create_dirs();
|
||||
|
||||
// Execute les requetes sql complementaires
|
||||
if (! $err)
|
||||
// Execute addons requests
|
||||
$num=count($array_sql);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
{
|
||||
$num=count($array_sql);
|
||||
for ($i = 0; $i < $num; $i++)
|
||||
if (! $err)
|
||||
{
|
||||
if (! $err)
|
||||
$val=$array_sql[$i];
|
||||
$sql='';
|
||||
$ignoreerror=0;
|
||||
if (is_array($val))
|
||||
{
|
||||
$val=$array_sql[$i];
|
||||
$sql='';
|
||||
$ignoreerror=0;
|
||||
if (is_array($val))
|
||||
$sql=$val['sql'];
|
||||
$ignoreerror=$val['ignoreerror'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql=$val;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::_init ignoreerror=".$ignoreerror." sql=".$sql, LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
if (! $ignoreerror)
|
||||
{
|
||||
$sql=$val['sql'];
|
||||
$ignoreerror=$val['ignoreerror'];
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::_init Error ".$this->error, LOG_ERR);
|
||||
$err++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql=$val;
|
||||
}
|
||||
|
||||
dol_syslog(get_class($this)."::_init ignoreerror=".$ignoreerror." sql=".$sql, LOG_DEBUG);
|
||||
$result=$this->db->query($sql);
|
||||
if (! $result)
|
||||
{
|
||||
if (! $ignoreerror)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog(get_class($this)."::_init Error ".$this->error, LOG_ERR);
|
||||
$err++;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this)."::_init Warning ".$this->db->lasterror(), LOG_WARNING);
|
||||
}
|
||||
dol_syslog(get_class($this)."::_init Warning ".$this->db->lasterror(), LOG_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@ -39,13 +39,13 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
var $emetteur; // Objet societe qui emet
|
||||
|
||||
var $phpmin = array(5,2,0); // Minimum version of PHP required by module
|
||||
var $version = 'development';
|
||||
var $version = 'dolibarr';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Database handler
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function doc_generic_order_odt($db)
|
||||
{
|
||||
@ -107,7 +107,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
'object_date_modification'=>dol_print_date($object->date_modification,'day'),
|
||||
'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'),
|
||||
'object_date_close'=>dol_print_date($object->date_cloture,'dayhour'),
|
||||
'object_payment_mode'=>$object->mode_reglement,
|
||||
'object_payment_mode'=>($object->mode_reglement!='-'?$object->mode_reglement:''),
|
||||
'object_payment_term'=>$object->cond_reglement,
|
||||
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
|
||||
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
|
||||
@ -144,7 +144,7 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Return description of a module
|
||||
* @param langs Lang object to use for output
|
||||
* @return string Description
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Laurent Destailleur <ely@users.sourceforge.net>
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <ely@users.sourceforge.net>
|
||||
|
||||
* 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
|
||||
@ -45,7 +45,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Database handler
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function doc_generic_invoice_odt($db)
|
||||
{
|
||||
@ -115,7 +115,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
'object_date_creation'=>dol_print_date($object->date_creation,'day'),
|
||||
'object_date_modification'=>dol_print_date($object->date_modification,'day'),
|
||||
'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'),
|
||||
'object_payment_mode'=>$object->mode_reglement,
|
||||
'object_payment_mode'=>($object->mode_reglement!='-'?$object->mode_reglement:''),
|
||||
'object_payment_term'=>$object->cond_reglement,
|
||||
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
|
||||
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
|
||||
|
||||
@ -90,7 +90,7 @@ class modCommande extends DolibarrModules
|
||||
$this->const[$r][2] = "mod_commande_marbre";
|
||||
$this->const[$r][3] = 'Nom du gestionnaire de numerotation des commandes';
|
||||
$this->const[$r][4] = 0;
|
||||
|
||||
|
||||
$r++;
|
||||
$this->const[$r][0] = "COMMANDE_ADDON_PDF_ODT_PATH";
|
||||
$this->const[$r][1] = "chaine";
|
||||
@ -195,7 +195,7 @@ class modCommande extends DolibarrModules
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
global $conf;
|
||||
global $conf,$langs;
|
||||
|
||||
// Permissions
|
||||
$this->remove();
|
||||
@ -204,11 +204,18 @@ class modCommande extends DolibarrModules
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/orders';
|
||||
create_exdir($dirodt);
|
||||
dol_copy(DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt',$dirodt.'/template_order.odt',0,0);
|
||||
|
||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/orders/template_order.odt'; $dest=$dirodt.'/template_order.odt';
|
||||
$result=dol_copy($src,$dest,0,0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."'",
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES('".$this->const[0][2]."','order')"
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','order',".$conf->entity.")"
|
||||
);
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
@ -216,8 +223,12 @@ class modCommande extends DolibarrModules
|
||||
|
||||
|
||||
/**
|
||||
* \brief Fonction appelee lors de la desactivation d'un module.
|
||||
* Supprime de la base les constantes, boites et permissions du module.
|
||||
* Function called when module is disabled.
|
||||
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||
* Data directories are not deleted
|
||||
*
|
||||
* @param string $options Options when enabling module ('', 'noboxes')
|
||||
* @return int 1 if OK, 0 if KO
|
||||
*/
|
||||
function remove()
|
||||
{
|
||||
|
||||
@ -212,7 +212,7 @@ class modFacture extends DolibarrModules
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
global $conf;
|
||||
global $conf,$langs;
|
||||
|
||||
// Remove permissions and default values
|
||||
$this->remove($options);
|
||||
@ -220,11 +220,18 @@ class modFacture extends DolibarrModules
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/invoices';
|
||||
create_exdir($dirodt);
|
||||
dol_copy(DOL_DOCUMENT_ROOT.'/install/doctemplates/invoices/template_invoice.odt',$dirodt.'/template_invoice.odt',0,0);
|
||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/invoices/template_invoice.odt'; $dest=$dirodt.'/template_invoice.odt';
|
||||
$result=dol_copy($src,$dest,0,0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','invoice',".$conf->entity.")",
|
||||
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','invoice',".$conf->entity.")"
|
||||
);
|
||||
|
||||
return $this->_init($sql,$options);
|
||||
|
||||
@ -190,7 +190,7 @@ class modPropale extends DolibarrModules
|
||||
*/
|
||||
function init($options='')
|
||||
{
|
||||
global $conf;
|
||||
global $conf,$langs;
|
||||
|
||||
// Remove permissions and default values
|
||||
$this->remove();
|
||||
@ -199,7 +199,14 @@ class modPropale extends DolibarrModules
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/proposals';
|
||||
create_exdir($dirodt);
|
||||
dol_copy(DOL_DOCUMENT_ROOT.'/install/doctemplates/proposals/template_proposal.odt',$dirodt.'/template_proposal.odt',0,0);
|
||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/proposals/template_proposal.odt'; $dest=$dirodt.'/template_proposal.odt';
|
||||
$result=dol_copy($src,$dest,0,0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
|
||||
|
||||
@ -316,7 +316,14 @@ class modSociete extends DolibarrModules
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
|
||||
$dirodt=DOL_DATA_ROOT.'/doctemplates/thirdparties';
|
||||
create_exdir($dirodt);
|
||||
dol_copy(DOL_DOCUMENT_ROOT.'/install/doctemplates/thirdparties/template_thirdparty.odt',$dirodt.'/template_thirdparty.odt',0,0);
|
||||
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/thirdparties/template_thirdparty.odt'; $dest=$dirodt.'/template_thirdparty.odt';
|
||||
$result=dol_copy($src,$dest,0,0);
|
||||
if ($result < 0)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
|
||||
return 0;
|
||||
}
|
||||
|
||||
$sql = array();
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@ -39,13 +39,13 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
var $emetteur; // Objet societe qui emet
|
||||
|
||||
var $phpmin = array(5,2,0); // Minimum version of PHP required by module
|
||||
var $version = 'development';
|
||||
var $version = 'dolibarr';
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $DB Database handler
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
function doc_generic_proposal_odt($db)
|
||||
{
|
||||
@ -102,11 +102,11 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
'object_ref_ext'=>$object->ref_ext,
|
||||
'object_ref_customer'=>$object->ref_client,
|
||||
'object_date'=>dol_print_date($object->date,'day'),
|
||||
'object_fin_validite'=>dol_print_date($object->fin_validite,'dayhour'),
|
||||
'object_date_end'=>dol_print_date($object->fin_validite,'day'),
|
||||
'object_date_creation'=>dol_print_date($object->date_creation,'day'),
|
||||
'object_date_modification'=>dol_print_date($object->date_modification,'day'),
|
||||
'object_date_validation'=>dol_print_date($object->date_validation,'dayhour'),
|
||||
'object_payment_mode'=>$object->mode_reglement,
|
||||
'object_payment_mode'=>($object->mode_reglement!='-'?$object->mode_reglement:''),
|
||||
'object_payment_term'=>$object->cond_reglement,
|
||||
'object_total_ht'=>price($object->total_ht,0,$outputlangs),
|
||||
'object_total_vat'=>price($object->total_tva,0,$outputlangs),
|
||||
@ -143,7 +143,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* Return description of a module
|
||||
* @param langs Lang object to use for output
|
||||
* @return string Description
|
||||
|
||||
Binary file not shown.
@ -392,7 +392,7 @@ if (! $error && $db->connected && $action == "set")
|
||||
{
|
||||
// We must ignore errors as an existing old file may already exists and not be replacable or
|
||||
// the installer (like for ubuntu) may not have permission to create another file than conf.php.
|
||||
// Also no other process must be able to read file or we expose the new file so content with password.
|
||||
// Also no other process must be able to read file or we expose the new file, so content with password.
|
||||
@dol_copy($conffile, $conffile.'.old', '0400');
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@ ErrorBadUrl=Url %s is wrong
|
||||
ErrorLoginAlreadyExists=Login %s already exists.
|
||||
ErrorGroupAlreadyExists=Group %s already exists.
|
||||
ErrorRecordNotFound=Record not found.
|
||||
ErrorFailToCopyFile=Failed to copy file '<b>%s</b>' into '<b>%s</b>'.
|
||||
ErrorFailToRenameFile=Failed to rename file '<b>%s</b>' into '<b>%s</b>'.
|
||||
ErrorFailToDeleteFile=Failed to remove file '<b>%s</b>'.
|
||||
ErrorFailToCreateFile=Failed to create file '<b>%s</b>'.
|
||||
|
||||
@ -11,6 +11,7 @@ ErrorLoginAlreadyExists=Le login %s existe déjà.
|
||||
ErrorGroupAlreadyExists=Le groupe %s existe déjà.
|
||||
ErrorRecordNotFound=Enregistrement non trouvé.
|
||||
ErrorDuplicateTrigger=Un fichier trigger de classe '<b>%s</b>' est présent plusieurs fois. Supprimer le doublon du répertoire '<b>%s</b>'.
|
||||
ErrorFailToCopyFile=Echec de la copie du fichier '<b>%s</b>' en '<b>%s</b>'.
|
||||
ErrorFailToRenameFile=Echec du renommage du fichier '<b>%s</b>' en '<b>%s</b>'.
|
||||
ErrorFailToCreateFile=Echec de la création du fichier '<b>%s</b>'.
|
||||
ErrorFailToDeleteFile=Echec de l'effacement du fichier '<b>%s</b>'.
|
||||
|
||||
@ -89,6 +89,9 @@ class AdherentTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -101,6 +104,9 @@ class AdherentTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -121,6 +121,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -133,6 +136,9 @@ class BuildDocTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -89,6 +89,9 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -101,6 +104,9 @@ class CMailFileTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -90,6 +90,9 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -102,6 +105,9 @@ class CategorieTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -89,6 +89,9 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -101,6 +104,9 @@ class ChargeSocialesTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -90,6 +90,9 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -103,6 +106,9 @@ class CommandeFournisseurTest extends PHPUnit_Framework_TestCase
|
||||
//print $db->getVersion()."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -89,6 +89,9 @@ class CommandeTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -102,6 +105,9 @@ class CommandeTest extends PHPUnit_Framework_TestCase
|
||||
//print $db->getVersion()."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -90,6 +90,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -102,6 +105,9 @@ class CommonObjectTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -89,6 +89,9 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -102,6 +105,9 @@ class CompanyBankAccountTest extends PHPUnit_Framework_TestCase
|
||||
//print $db->getVersion()."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -91,6 +91,9 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -103,6 +106,9 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
@ -143,7 +149,7 @@ class ContactTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$localobject=new Contact($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
|
||||
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
|
||||
@ -89,6 +89,9 @@ class ContratTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -101,6 +104,9 @@ class ContratTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
@ -120,10 +126,10 @@ class ContratTest extends PHPUnit_Framework_TestCase
|
||||
$localobject=new Contrat($this->savdb);
|
||||
$localobject->initAsSpecimen();
|
||||
$result=$localobject->create($user);
|
||||
|
||||
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -141,10 +147,10 @@ class ContratTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
$localobject=new Contrat($this->savdb);
|
||||
$result=$localobject->fetch($id);
|
||||
|
||||
|
||||
print __METHOD__." id=".$id." result=".$result."\n";
|
||||
$this->assertLessThan($result, 0);
|
||||
|
||||
|
||||
return $localobject;
|
||||
}
|
||||
|
||||
|
||||
@ -88,6 +88,9 @@ class CoreTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -100,6 +103,9 @@ class CoreTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -89,6 +89,9 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -101,6 +104,9 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -89,6 +89,9 @@ class DiscountTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -102,6 +105,9 @@ class DiscountTest extends PHPUnit_Framework_TestCase
|
||||
//print $db->getVersion()."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -92,9 +92,9 @@ class ExportTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Ran on start
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -107,9 +107,9 @@ class ExportTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* Ran on start
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -89,6 +89,9 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -101,6 +104,9 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -90,6 +90,9 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -102,6 +105,9 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
@ -109,7 +115,10 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
* testDolCountNbOfLine
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testDolCountNbOfLine()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
@ -127,7 +136,10 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
* testDolIsFileDir
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testDolIsFileDir()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
@ -150,6 +162,9 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolOther
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testDolOther()
|
||||
{
|
||||
@ -176,5 +191,53 @@ class FilesLibTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolCopyMove
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testDolCopyMove()
|
||||
{
|
||||
global $conf,$user,$langs,$db;
|
||||
$conf=$this->savconf;
|
||||
$user=$this->savuser;
|
||||
$langs=$this->savlangs;
|
||||
$db=$this->savdb;
|
||||
|
||||
$file=dirname(__FILE__).'/Example_import_company_1.csv';
|
||||
|
||||
$result=dol_copy($file, '/adir/that/does/not/exists/file.csv');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertLessThan(0,$result); // We should have error
|
||||
|
||||
$result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,1);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertGreaterThanOrEqual(1,$result); // Should be 1
|
||||
|
||||
// Again to test with overwriting=0
|
||||
$result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,0);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(0,$result); // Should be 0
|
||||
|
||||
// Again to test with overwriting=1
|
||||
$result=dol_copy($file, $conf->admin->dir_temp.'/file.csv',0,1);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertGreaterThanOrEqual(1,$result); // Should be 1
|
||||
|
||||
// Again to test with overwriting=1
|
||||
$result=dol_move($conf->admin->dir_temp.'/file.csv',$conf->admin->dir_temp.'/file2.csv',0,1);
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertTrue($result);
|
||||
|
||||
$result=dol_delete_file($conf->admin->dir_temp.'/file2.csv');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertTrue($result);
|
||||
|
||||
// Again to test no erreor when deleteing a non existing file
|
||||
$result=dol_delete_file($conf->admin->dir_temp.'/file2.csv');
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
}
|
||||
?>
|
||||
@ -91,6 +91,9 @@ class ImportTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -103,6 +106,9 @@ class ImportTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
@ -88,6 +88,9 @@ class ModulesTest extends PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* Init phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
@ -100,6 +103,9 @@ class ModulesTest extends PHPUnit_Framework_TestCase
|
||||
print __METHOD__."\n";
|
||||
}
|
||||
/**
|
||||
* End phpunit tests
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function tearDown()
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user