Skip to content
Snippets Groups Projects
Commit 86de0f94 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: A lot of fix to solve code coverage errors.

parent e79d22e1
No related branches found
No related tags found
No related merge requests found
......@@ -46,7 +46,7 @@ function print_auguria_menu($db,$atarget,$hideifnotallowed)
$menuArbo = new Menubase($db,'auguria','top');
$tabMenu = $menuArbo->menuTopCharger($hideifnotallowed,$_SESSION['mainmenu'], 'auguria');
print_start_menu_array();
print_start_menu_array_auguria();
for($i=0; $i<count($tabMenu); $i++)
{
......@@ -77,50 +77,50 @@ function print_auguria_menu($db,$atarget,$hideifnotallowed)
else if (! empty($_SESSION['mainmenu']) && $tabMenu[$i]['mainmenu'] == $_SESSION['mainmenu']) $classname='class="tmenusel"';
else $classname='class="tmenu"';
print_start_menu_entry($idsel);
print_start_menu_entry_auguria($idsel);
print '<div class="mainmenu '.$idsel.'"><span class="mainmenu_'.$idsel.'" id="mainmenuspan_'.$idsel.'"></span></div>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($tabMenu[$i]['atarget']?" target='".$tabMenu[$i]['atarget']."'":($atarget?" target=$atarget":"")).'>';
print_text_menu_entry($tabMenu[$i]['titre']);
print_text_menu_entry_auguria($tabMenu[$i]['titre']);
print '</a>';
print_end_menu_entry();
print_end_menu_entry_auguria();
}
else
{
if (! $hideifnotallowed)
{
print_start_menu_entry($idsel);
print_start_menu_entry_auguria($idsel);
print '<div class="mainmenu '.$idsel.'"><span class="mainmenu_'.$idsel.'" id="mainmenuspan_'.$idsel.'"></span></div>';
print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#">';
print_text_menu_entry($tabMenu[$i]['titre']);
print_text_menu_entry_auguria($tabMenu[$i]['titre']);
print '</a>';
print_end_menu_entry();
print_end_menu_entry_auguria();
}
}
}
}
print_end_menu_array();
print_end_menu_array_auguria();
print "\n";
}
function print_start_menu_array()
function print_start_menu_array_auguria()
{
global $conf;
if (preg_match('/bluelagoon|eldy|freelug|rodolphe|yellow|dev/',$conf->css)) print '<table class="tmenu" summary="topmenu"><tr class="tmenu">';
else print '<ul class="tmenu">';
}
function print_start_menu_entry($idsel)
function print_start_menu_entry_auguria($idsel)
{
global $conf;
if (preg_match('/bluelagoon|eldy|freelug|rodolphe|yellow|dev/',$conf->css)) print '<td class="tmenu" id="mainmenutd_'.$idsel.'">';
else print '<li class="tmenu" id="mainmenutd_'.$idsel.'">';
}
function print_text_menu_entry($text)
function print_text_menu_entry_auguria($text)
{
global $conf;
print '<span class="mainmenuaspan">';
......@@ -128,7 +128,7 @@ function print_text_menu_entry($text)
print '</span>';
}
function print_end_menu_entry()
function print_end_menu_entry_auguria()
{
global $conf;
if (preg_match('/bluelagoon|eldy|freelug|rodolphe|yellow|dev/',$conf->css)) print '</td>';
......@@ -136,7 +136,7 @@ function print_end_menu_entry()
print "\n";
}
function print_end_menu_array()
function print_end_menu_array_auguria()
{
global $conf;
if (preg_match('/bluelagoon|eldy|freelug|rodolphe|yellow|dev/',$conf->css)) print '</tr></table>';
......
......@@ -51,39 +51,39 @@ class MenuTop {
{
global $user,$conf,$langs,$dolibarr_main_db_name;;
print_start_menu_array();
print_start_menu_array_empty();
$idsel='none';
$classname='class="tmenu"';
print_start_menu_entry($idsel);
print_start_menu_entry_empty($idsel);
print '<div class="mainmenu '.$idsel.'"><span class="mainmenu_'.$idsel.'" id="mainmenuspan_'.$idsel.'"></span></div>';
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($tabMenu[$i]['atarget']?" target='".$tabMenu[$i]['atarget']."'":($atarget?" target=$atarget":"")).'>';
print_text_menu_entry($langs->trans("Home"));
print_text_menu_entry_empty($langs->trans("Home"));
print '</a>';
print_end_menu_entry();
print_end_menu_entry_empty();
print_end_menu_array();
print_end_menu_array_empty();
}
}
function print_start_menu_array()
function print_start_menu_array_empty()
{
global $conf;
if (preg_match('/bluelagoon|eldy|freelug|rodolphe|yellow|dev/',$conf->css)) print '<table class="tmenu" summary="topmenu"><tr class="tmenu">';
else print '<ul class="tmenu">';
}
function print_start_menu_entry($idsel)
function print_start_menu_entry_empty($idsel)
{
global $conf;
if (preg_match('/bluelagoon|eldy|freelug|rodolphe|yellow|dev/',$conf->css)) print '<td class="tmenu" id="mainmenutd_'.$idsel.'">';
else print '<li class="tmenu" id="mainmenutd_'.$idsel.'">';
}
function print_text_menu_entry($text)
function print_text_menu_entry_empty($text)
{
global $conf;
print '<span class="mainmenuaspan">';
......@@ -91,7 +91,7 @@ function print_text_menu_entry($text)
print '</span>';
}
function print_end_menu_entry()
function print_end_menu_entry_empty()
{
global $conf;
if (preg_match('/bluelagoon|eldy|freelug|rodolphe|yellow|dev/',$conf->css)) print '</td>';
......@@ -99,7 +99,7 @@ function print_end_menu_entry()
print "\n";
}
function print_end_menu_array()
function print_end_menu_array_empty()
{
global $conf;
if (preg_match('/bluelagoon|eldy|freelug|rodolphe|yellow|dev/',$conf->css)) print '</tr></table>';
......
......@@ -21,10 +21,9 @@
*/
/**
* \file htdocs/includes/modules/facture/modules_facture.php
* \file htdocs/includes/modules/cheque/pdf/modules_chequereceipts.php
* \ingroup facture
* \brief Fichier contenant la classe mere de generation des factures en PDF
* et la classe mere de numerotation des factures
* \brief File with parent class of check receipt document generators
* \version $Id$
*/
......@@ -50,12 +49,12 @@ class ModeleChequeReceipts
{
global $conf;
$type='remisecheque';
$type='chequereceipt';
$liste=array();
include_once(DOL_DOCUMENT_ROOT.'/lib/functions2.lib.php');
$liste=getListOfModels($db,$type,'');
// TODO Remove this to use getListOfModels only
$liste = array('blochet'=>'blochet');
return $liste;
......@@ -110,21 +109,6 @@ function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs)
$sav_charset_output=$outputlangs->charset_output;
if ($obj->write_file($id, $outputlangs) > 0)
{
if (! is_object($id)) // Old method
{
// Success in building document. We build meta file.
facture_meta_create($db, $id);
// et on supprime l'image correspondant au preview
facture_delete_preview($db, $id);
}
else
{
// Success in building document. We build meta file.
facture_meta_create($db, $id->id);
// et on supprime l'image correspondant au preview
facture_delete_preview($db, $id->id);
}
$outputlangs->charset_output=$sav_charset_output;
return 1;
}
......@@ -143,91 +127,4 @@ function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs)
}
}
/**
* \brief Cree un meta fichier a cote de la facture sur le disque pour faciliter les recherches en texte plein.
* Pourquoi ? tout simplement parcequ'en fin d'exercice quand je suis avec mon comptable je n'ai pas de
* connexion internet "rapide" pour retrouver en 2 secondes une facture non payee ou compliquee a gerer ... avec un rgrep c'est vite fait bien fait [eric seigne]
* \param db Objet base de donnee
* \param facid Id de la facture a creer
* \param message Message
*/
function facture_meta_create($db, $facid, $message="")
{
global $langs,$conf;
$fac = new Facture($db,"",$facid);
$fac->fetch($facid);
$fac->fetch_client();
if ($conf->facture->dir_output)
{
$facref = dol_sanitizeFileName($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref ;
$file = $dir . "/" . $facref . ".meta";
if (! is_dir($dir))
{
create_exdir($dir);
}
if (is_dir($dir))
{
$nblignes = sizeof($fac->lignes);
$client = $fac->client->nom . " " . $fac->client->address . " " . $fac->client->cp . " " . $fac->client->ville;
$meta = "REFERENCE=\"" . $fac->ref . "\"
DATE=\"" . dol_print_date($fac->date,'') . "\"
NB_ITEMS=\"" . $nblignes . "\"
CLIENT=\"" . $client . "\"
TOTAL_HT=\"" . $fac->total_ht . "\"
TOTAL_TTC=\"" . $fac->total_ttc . "\"\n";
for ($i = 0 ; $i < $nblignes ; $i++)
{
//Pour les articles
$meta .= "ITEM_" . $i . "_QUANTITY=\"" . $fac->lignes[$i]->qty . "\"
ITEM_" . $i . "_UNIT_PRICE=\"" . $fac->lignes[$i]->price . "\"
ITEM_" . $i . "_TVA=\"" .$fac->lignes[$i]->tva_tx . "\"
ITEM_" . $i . "_DESCRIPTION=\"" . str_replace("\r\n","",nl2br($fac->lignes[$i]->desc)) . "\"
";
}
}
$fp = fopen ($file,"w");
fputs($fp,$meta);
fclose($fp);
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
}
/**
* \brief Supprime l'image de previsualitation, pour le cas de regeneration de facture
* \param db objet base de donnee
* \param facid id de la facture a creer
*/
function facture_delete_preview($db, $facid)
{
global $langs,$conf;
$fac = new Facture($db,"",$facid);
$fac->fetch($facid);
if ($conf->facture->dir_output)
{
$facref = dol_sanitizeFileName($fac->ref);
$dir = $conf->facture->dir_output . "/" . $facref ;
$file = $dir . "/" . $facref . ".pdf.png";
if ( file_exists( $file ) && is_writable( $file ) )
{
if ( ! dol_delete_file($file,1) )
{
return 0;
}
}
}
return 1;
}
?>
\ No newline at end of file
doc_generic_odt.modules.php
......@@ -18,7 +18,7 @@
*/
/**
* \file htdocs/includes/modules/facture/doc/doc_generic_odt.modules.php
* \file htdocs/includes/modules/facture/doc/doc_generic_invoice_odt.modules.php
* \ingroup societe
* \brief File of class to build ODT documents for third parties
* \author Laurent Destailleur
......@@ -33,10 +33,10 @@ require_once(DOL_DOCUMENT_ROOT."/lib/files.lib.php");
/**
* \class doc_generic_odt
* \class doc_generic_invoice_odt
* \brief Class to build documents using ODF templates generator
*/
class doc_generic_odt extends ModelePDFFactures
class doc_generic_invoice_odt extends ModelePDFFactures
{
var $emetteur; // Objet societe qui emet
......@@ -47,7 +47,7 @@ class doc_generic_odt extends ModelePDFFactures
* \brief Constructor
* \param db Database handler
*/
function doc_generic_odt($db)
function doc_generic_invoice_odt($db)
{
global $conf,$langs,$mysoc;
......@@ -80,7 +80,7 @@ class doc_generic_odt extends ModelePDFFactures
/**
* Define array with couple subtitution key => subtitution value
*
* @param unknown_type $mysoc
* @param $mysoc
*/
function get_substitutionarray_mysoc($mysoc)
{
......@@ -120,7 +120,7 @@ class doc_generic_odt extends ModelePDFFactures
/**
* Define array with couple subtitution key => subtitution value
*
* @param unknown_type $object
* @param $object
*/
function get_substitutionarray_object($object)
{
......
......@@ -79,7 +79,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
/**
* Define array with couple subtitution key => subtitution value
*
* @param unknown_type $mysoc
* @param $mysoc
*/
function get_substitutionarray_mysoc($mysoc)
{
......@@ -119,7 +119,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc
/**
* Define array with couple subtitution key => subtitution value
*
* @param unknown_type $object
* @param $object
*/
function get_substitutionarray_object($object)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment