Merge branch 'develop' into api_restler

This commit is contained in:
jfefe 2015-05-03 23:43:13 +02:00
commit 53f480708f
65 changed files with 1985 additions and 1555 deletions

View File

@ -1,10 +1,10 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.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
@ -48,8 +48,8 @@ $list = array (
'ACCOUNTING_SELL_JOURNAL',
'ACCOUNTING_PURCHASE_JOURNAL',
'ACCOUNTING_SOCIAL_JOURNAL',
'ACCOUNTING_CASH_JOURNAL',
'ACCOUNTING_MISCELLANEOUS_JOURNAL'
'ACCOUNTING_MISCELLANEOUS_JOURNAL',
'ACCOUNTING_EXPENSEREPORT_JOURNAL'
);
/*

View File

@ -543,7 +543,7 @@ if ($action == 'edit' || $action == 'updateedit')
$var=!$var;
print '<tr '.$bc[$var].'><td width="35%"><label for="fiscalmonthstart">'.$langs->trans("FiscalMonthStart").'</label></td><td>';
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',1) . '</td></tr>';
print $formother->select_month($conf->global->SOCIETE_FISCAL_MONTH_START,'fiscalmonthstart',0,1) . '</td></tr>';
print "</table>";

View File

@ -294,7 +294,6 @@ $form=new Form($db);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("BillsSetup"),$linkback,'title_setup');
print '<br>';
$head = invoice_admin_prepare_head();
dol_fiche_head($head, 'general', $langs->trans("Invoices"), 0, 'invoice');

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@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
@ -10,7 +10,7 @@
*
* 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
* 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
@ -18,9 +18,9 @@
*/
/**
* \file htdocs/barcode/printsheet.php
* \ingroup member
* \brief Page to print sheets with barcodes using the document templates into core/modules/printsheets
* \file htdocs/barcode/printsheet.php
* \ingroup member
* \brief Page to print sheets with barcodes using the document templates into core/modules/printsheets
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
@ -96,13 +96,13 @@ if ($action == 'builddoc')
if (empty($forbarcode)) // barcode value
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("BarcodeValue")),'errors');
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("BarcodeValue")),'errors');
$error++;
}
if (empty($fk_barcode_type)) // barcode type = barcode encoding
{
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("BarcodeType")),'errors');
$error++;
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("BarcodeType")),'errors');
$error++;
}
if (! $error)
@ -123,46 +123,54 @@ if ($action == 'builddoc')
$code=$forbarcode;
$generator=$stdobject->barcode_type_coder; // coder (loaded by fetch_barcode). Engine.
$encoding=strtoupper($stdobject->barcode_type_code); // code (loaded by fetch_barcode). Example 'ean', 'isbn', ...
$barcodeimage=$conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
$diroutput=$conf->barcode->dir_temp;
dol_mkdir($diroutput);
// Generate barcode
$dirbarcode=array_merge(array("/core/modules/barcode/doc/"),$conf->modules_parts['barcode']);
$dirbarcode=array_merge(array("/core/modules/barcode/doc/"),$conf->modules_parts['barcode']);
foreach($dirbarcode as $reldir)
{
$dir=dol_buildpath($reldir,0);
$newdir=dol_osencode($dir);
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
if (! is_dir($newdir)) continue;
$result=@include_once $newdir.$generator.'.modules.php';
if ($result) break;
}
// Load barcode class
$classname = "mod".ucfirst($generator);
$module = new $classname($db);
if ($module->encodingIsSupported($encoding))
{
dol_delete_file($barcodeimage);
// File is created with full name $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
$result=$module->writeBarCode($code,$encoding,'Y',4);
if ($result <= 0 || ! dol_is_file($barcodeimage))
{
$error++;
setEventMessage('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), 'errors');
}
}
else
foreach($dirbarcode as $reldir)
{
$error++;
setEventMessage("Error, encoding ".$encoding." is not supported by encoder ".$generator.'. You must choose another barcode type or install a barcode generation engine that support '.$encoding, 'errors');
}
$dir=dol_buildpath($reldir,0);
$newdir=dol_osencode($dir);
// Check if directory exists (we do not use dol_is_dir to avoid loading files.lib.php)
if (! is_dir($newdir)) continue;
$result=@include_once $newdir.$generator.'.modules.php';
if ($result) break;
}
// Load barcode class for generating barcode image
$classname = "mod".ucfirst($generator);
$module = new $classname($db);
if ($generator != 'tcpdfbarcode') {
$template = 'standardlabel';
$is2d = false;
if ($module->encodingIsSupported($encoding))
{
$barcodeimage=$conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
dol_delete_file($barcodeimage);
// File is created with full name $barcodeimage = $conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
$result=$module->writeBarCode($code,$encoding,'Y',4);
if ($result <= 0 || ! dol_is_file($barcodeimage))
{
$error++;
setEventMessage('Failed to generate image file of barcode for code='.$code.' encoding='.$encoding.' file='.basename($barcodeimage), 'errors');
}
}
else
{
$error++;
setEventMessage("Error, encoding ".$encoding." is not supported by encoder ".$generator.'. You must choose another barcode type or install a barcode generation engine that support '.$encoding, 'errors');
}
} else {
$template = 'tcpdflabel';
$encoding = $module->getTcpdfEncodingType($encoding); //convert to TCPDF compatible encoding types
$is2d = $module->is2d;
}
}
if (! $error)
@ -188,11 +196,12 @@ if ($action == 'builddoc')
// For labels
if ($mode == 'label')
{
$txtforsticker="%PHOTO%";
$textleft=make_substitutions($txtforsticker, $substitutionarray);
$textheader='';
$textfooter='';
$textright='';
$txtforsticker="%PHOTO%"; // Photo will be barcode image, %BARCODE% posible when using TCPDF generator
$textleft=make_substitutions((empty($conf->global->BARCODE_LABEL_LEFT_TEXT)?$txtforsticker:$conf->global->BARCODE_LABEL_LEFT_TEXT), $substitutionarray);
$textheader=make_substitutions((empty($conf->global->BARCODE_LABEL_HEADER_TEXT)?'':$conf->global->BARCODE_LABEL_HEADER_TEXT), $substitutionarray);
$textfooter=make_substitutions((empty($conf->global->BARCODE_LABEL_FOOTER_TEXT)?'':$conf->global->BARCODE_LABEL_FOOTER_TEXT), $substitutionarray);
$textright=make_substitutions((empty($conf->global->BARCODE_LABEL_RIGHT_TEXT)?'':$conf->global->BARCODE_LABEL_RIGHT_TEXT), $substitutionarray);
$forceimgscalewidth=(empty($conf->global->BARCODE_FORCEIMGSCALEWIDTH)?1:$conf->global->BARCODE_FORCEIMGSCALEWIDTH);
$forceimgscaleheight=(empty($conf->global->BARCODE_FORCEIMGSCALEHEIGHT)?1:$conf->global->BARCODE_FORCEIMGSCALEHEIGHT);
@ -203,6 +212,9 @@ if ($action == 'builddoc')
'textheader'=>$textheader,
'textfooter'=>$textfooter,
'textright'=>$textright,
'code'=>$code,
'encoding'=>$encoding,
'is2d'=>$is2d,
'photo'=>$barcodeimage // Photo must be a file that exists with format supported by TCPDF
);
}
@ -222,7 +234,7 @@ if ($action == 'builddoc')
{
$mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE"));
}
if (! $mesg) $result=members_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs, $diroutput);
if (! $mesg) $result=members_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs, $diroutput, $template);
}
if ($result <= 0)
@ -230,11 +242,11 @@ if ($action == 'builddoc')
dol_print_error('',$result);
}
if (! $mesg)
{
$db->close();
exit;
}
if (! $mesg)
{
$db->close();
exit;
}
}
}

View File

@ -1064,11 +1064,11 @@ class Categorie extends CommonObject
*/
function print_all_ways($sep = " &gt;&gt; ", $url='')
{
$ways = array ();
$ways = array();
foreach ($this->get_all_ways() as $way)
{
$w = array ();
$w = array();
foreach ($way as $cat)
{
if ($url == '')

View File

@ -1539,7 +1539,7 @@ class Commande extends CommonOrder
if ($this->statut == self::STATUS_DRAFT) $this->brouillon = 1;
// Retreive all extrafield for invoice
// Retrieve all extrafields for invoice
// fetch optionals attributes and labels
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields=new ExtraFields($this->db);

View File

@ -1414,7 +1414,11 @@ if (empty($reshook))
$model=$object->modelpdf;
$ret = $object->fetch($id); // Reload to get new records
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result < 0)
{
setEventMessages($object->error, $object->errors, 'errors');
}
}
unset($_POST['prod_entry_mode']);

View File

@ -3504,7 +3504,7 @@ class Facture extends CommonInvoice
/**
* Create a document onto disk according to template module.
*
* @param string $modele Force template to use ('' to not force)
* @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf') for example.
* @param Translate $outputlangs objet lang a utiliser pour traduction
* @param int $hidedetails Hide details of lines
* @param int $hidedesc Hide description
@ -3532,22 +3532,24 @@ class Facture extends CommonInvoice
$modelpath = "core/modules/facture/doc/";
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
$result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
return $result;
}
/**
* Gets the smallest reference available for a new cycle
*
* @return int >= 1 if OK, -1 if error
*
*
*/
function newCycle()
{
$sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture';
$sql = 'SELECT max(situation_cycle_ref) FROM ' . MAIN_DB_PREFIX . 'facture as f';
$sql.= " WHERE f.entity in (".getEntity('facture').")";
$resql = $this->db->query($sql);
if ($resql) {
if ($resql->num_rows > 0) {
if ($resql->num_rows > 0)
{
$res = $this->db->fetch_array($resql);
$ref = $res['max(situation_cycle_ref)'];
$ref++;
@ -3557,7 +3559,7 @@ class Facture extends CommonInvoice
$this->db->free($resql);
return $ref;
} else {
$this->error = $this->db->error();
$this->error = $this->db->lasterror();
dol_syslog("Error sql=" . $sql . ", error=" . $this->error, LOG_ERR);
return -1;
}

View File

@ -37,8 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/contract.lib.php';
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php';
if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
@ -1279,9 +1279,7 @@ else
* Lines of contracts
*/
if ($conf->product->enabled || $conf->service->enabled) {
$productstatic=new Product($db);
}
$productstatic=new Product($db);
$usemargins=0;
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
@ -1343,19 +1341,28 @@ else
$productstatic->id=$objp->fk_product;
$productstatic->type=$objp->ptype;
$productstatic->ref=$objp->pref;
print $productstatic->getNomUrl(1,'',20);
$text = $productstatic->getNomUrl(1,'',20);
if ($objp->label)
{
print ' - ';
$text .= ' - ';
$productstatic->ref=$objp->label;
print $productstatic->getNomUrl(0,'',16);
$text .= $productstatic->getNomUrl(0,'',16);
}
if (! empty($conf->global->PRODUIT_DESC_IN_FORM) && !empty($objp->description))
print '<br>'.dol_nl2br($objp->description);
$description = $objp->description;
// Add description in form
if (! empty($conf->global->PRODUIT_DESC_IN_FORM))
{
$text .= (! empty($objp->description) && $objp->description!=$objp->product_label)?'<br>'.dol_htmlentitiesbr($objp->description):'';
$description = ''; // Already added into main visible desc
}
echo $form->textwithtooltip($text,$description,3,'','',$cursorline,0,(!empty($line->fk_parent_line)?img_picto('', 'rightarrow'):''));
print '</td>';
}
else
{
{
print '<td>'.dol_htmlentitiesbr($objp->description)."</td>\n";
}
// TVA

View File

@ -237,8 +237,8 @@ class Contrat extends CommonObject
/**
* Activate a contract line
*
* @param User $user Objet User qui active le contrat
* @param int $line_id Id de la ligne de detail a activer
* @param User $user Objet User who activate contract
* @param int $line_id Id of line to activate
* @param int $date Date d'ouverture
* @param int|string $date_end Date fin prevue
* @param string $comment A comment typed by user
@ -284,9 +284,9 @@ class Contrat extends CommonObject
/**
* Close a contract line
*
* @param User $user Objet User qui active le contrat
* @param int $line_id Id de la ligne de detail a activer
* @param int $date_end Date fin
* @param User $user Objet User who close contract
* @param int $line_id Id of line to close
* @param int $date_end Date end
* @param string $comment A comment typed by user
* @return int <0 if KO, >0 if OK
*/
@ -576,7 +576,7 @@ class Contrat extends CommonObject
$result=$this->fetch_lines();
if ($result < 0)
{
$this->error=$this->db->error();
$this->error=$this->db->lasterror();
return -3;
}
@ -599,7 +599,7 @@ class Contrat extends CommonObject
}
/**
* Load lignes array into this->lines
* Load lines array into this->lines
*
* @return ContratLigne[] Return array of contract lines
*/
@ -624,7 +624,7 @@ class Contrat extends CommonObject
$this->lines=array();
// Selectionne les lignes contrats liees a un produit
$sql = "SELECT p.label, p.description as product_desc, p.ref,";
$sql = "SELECT p.label as product_label, p.description as product_desc, p.ref as product_ref,";
$sql.= " d.rowid, d.fk_contrat, d.statut, d.description, d.price_ht, d.tva_tx, d.localtax1_tx, d.localtax2_tx, d.qty, d.remise_percent, d.subprice, d.fk_product_fournisseur_price as fk_fournprice, d.buy_price_ht as pa_ht,";
$sql.= " d.total_ht,";
$sql.= " d.total_tva,";
@ -684,10 +684,12 @@ class Contrat extends CommonObject
$line->fk_user_cloture = $objp->fk_user_cloture;
$line->fk_unit = $objp->fk_unit;
$line->ref = $objp->ref;
$line->libelle = $objp->label; // Label produit
$line->label = $objp->label; // For backward compatibility
$line->product_desc = $objp->product_desc; // Description produit
$line->ref = $objp->product_ref; // deprecated
$line->label = $objp->product_label; // deprecated
$line->libelle = $objp->product_label; // deprecated
$line->product_ref = $objp->product_ref; // Ref product
$line->product_desc = $objp->product_desc; // Description product
$line->product_label = $objp->product_label; // Label product
$line->description = $objp->description;
@ -2339,7 +2341,10 @@ class ContratLigne extends CommonObjectLine
$sql.= " t.fk_contrat,";
$sql.= " t.fk_product,";
$sql.= " t.statut,";
$sql.= " t.label,";
$sql.= " t.label,"; // This field is not used. Only label of product
$sql.= " p.ref as product_ref,";
$sql.= " p.label as product_label,";
$sql.= " p.description as product_desc,";
$sql.= " t.description,";
$sql.= " t.date_commande,";
$sql.= " t.date_ouverture_prevue as date_ouverture_prevue,";
@ -2368,7 +2373,7 @@ class ContratLigne extends CommonObjectLine
$sql.= " t.fk_user_cloture,";
$sql.= " t.commentaire,";
$sql.= " t.fk_unit";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as t";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as t LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = t.fk_product";
if ($id) $sql.= " WHERE t.rowid = ".$id;
if ($ref) $sql.= " WHERE t.rowid = '".$this->db->escape($ref)."'";
@ -2387,7 +2392,10 @@ class ContratLigne extends CommonObjectLine
$this->fk_contrat = $obj->fk_contrat;
$this->fk_product = $obj->fk_product;
$this->statut = $obj->statut;
$this->label = $obj->label;
$this->product_ref = $obj->product_ref;
$this->product_label = $obj->product_label;
$this->product_description = $obj->product_description;
$this->label = $obj->label; // deprecated. We do not use this field. Only ref and label of product, and description of contract line
$this->description = $obj->description;
$this->date_commande = $this->db->jdate($obj->date_commande);
$this->date_ouverture_prevue = $this->db->jdate($obj->date_ouverture_prevue);

View File

@ -3406,13 +3406,13 @@ abstract class CommonObject
/**
* Common function for all objects extending CommonObject for generating documents
*
* @param string $modelspath Relative folder where models are placed
* @param string $modele Model to use
* @param Translate $outputlangs Language to use
* @param int $hidedetails 1 to hide details. 0 by default
* @param int $hidedesc 1 to hide product description. 0 by default
* @param int $hideref 1 to hide product reference. 0 by default
* @return int 1 if OK -1 if not OK
* @param string $modelspath Relative folder where generators are placed
* @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf') for example.
* @param Translate $outputlangs Language to use
* @param int $hidedetails 1 to hide details. 0 by default
* @param int $hidedesc 1 to hide product description. 0 by default
* @param int $hideref 1 to hide product reference. 0 by default
* @return int >0 if OK, <0 if KO
*/
protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref)
{
@ -3426,7 +3426,7 @@ abstract class CommonObject
@set_time_limit(120);
error_reporting($err);
// If selected modele is a filename template (then $modele="modelname:filename")
// If selected model is a filename template (then $modele="modelname" or "modelname:filename")
$tmp=explode(':',$modele,2);
if (! empty($tmp[1]))
{
@ -3456,7 +3456,7 @@ abstract class CommonObject
if ($filefound) break;
}
// Charge le modele
// If generator was found
if ($filefound)
{
require_once $file;
@ -3464,6 +3464,47 @@ abstract class CommonObject
$obj = new $classname($this->db);
//$obj->message = $message;
// If generator is ODT, we must have srctemplatepath defined, if not we set it.
if ($obj->type == 'odt' && empty($srctemplatepath))
{
$varfortemplatedir=$obj->scandir;
if ($varfortemplatedir && ! empty($conf->global->$varfortemplatedir))
{
$dirtoscan=$conf->global->$varfortemplatedir;
$listoffiles=array();
// Now we add first model found in directories scanned
$listofdir=explode(',',$dirtoscan);
foreach($listofdir as $key=>$tmpdir)
{
$tmpdir=trim($tmpdir);
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
if (! $tmpdir) { unset($listofdir[$key]); continue; }
if (is_dir($tmpdir))
{
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.od(s|t)$','','name',SORT_ASC,0);
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
}
}
if (count($listoffiles))
{
foreach($listoffiles as $record)
{
$srctemplatepath=$record['fullname'];
break;
}
}
}
if (empty($srctemplatepath))
{
$this->error='ErrorGenerationAskedForOdtTemplateWithNoSrcFileFound';
return -1;
}
}
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
@ -3483,14 +3524,15 @@ abstract class CommonObject
else
{
$outputlangs->charset_output=$sav_charset_output;
dol_print_error($this->db,"Error generating document for ".__CLASS__.". Error: ".$obj->error);
dol_print_error($this->db, "Error generating document for ".__CLASS__.". Error: ".$obj->error, $obj->errors);
return -1;
}
}
else
{
dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file));
$this->error=$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file);
dol_print_error('',$this->error);
return -1;
}
}

View File

@ -0,0 +1,270 @@
<?php
/* Copyright (C) 2003 Steve Dillon
* Copyright (C) 2003 Laurent Passebecq
* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Francis Appels <francis.appels@yahoo.com>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
/* Inspire de PDF_Label
* PDF_Label - PDF label editing
* @package PDF_Label
* @author Laurent PASSEBECQ <lpasseb@numericable.fr>
* @copyright 2003 Laurent PASSEBECQ
* disponible ici : http://www.fpdf.org/fr/script/script29.php
*/
//-------------------------------------------------------------------
// VERSIONS :
// 1.0 : Initial release
// 1.1 : + : Added unit in the constructor
// + : Now Positions start @ (1,1).. then the first image @top-left of a page is (1,1)
// + : Added in the description of a label :
// font-size : defaut char size (can be changed by calling Set_Char_Size(xx);
// paper-size : Size of the paper for this sheet (thanx to Al Canton)
// metric : type of unit used in this description
// You can define your label properties in inches by setting metric to 'in'
// and printing in millimiter by setting unit to 'mm' in constructor.
// Added some labels :
// 5160, 5161, 5162, 5163,5164 : thanx to Al Canton : acanton@adams-blake.com
// 8600 : thanx to Kunal Walia : kunal@u.washington.edu
// + : Added 3mm to the position of labels to avoid errors
////////////////////////////////////////////////////
/**
* \file htdocs/core/class/commonstickergenerator.class.php
* \ingroup core
* \brief generate pdf document with labels or cards in Avery or custom format
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
/**
* Class to generate stick sheet with format Avery or other personalised
*/
abstract class CommonStickerGenerator
{
public $code; // Code of format
public $format; // Array with informations
// protected
var $_Avery_Name = ''; // Nom du format de l'etiquette
var $_Margin_Left = 0; // Marge de gauche de l'etiquette
var $_Margin_Top = 0; // marge en haut de la page avant la premiere etiquette
var $_X_Space = 0; // Espace horizontal entre 2 bandes d'etiquettes
var $_Y_Space = 0; // Espace vertical entre 2 bandes d'etiquettes
var $_X_Number = 0; // NX Nombre d'etiquettes sur la largeur de la page
var $_Y_Number = 0; // NY Nombre d'etiquettes sur la hauteur de la page
var $_Width = 0; // Largeur de chaque etiquette
var $_Height = 0; // Hauteur de chaque etiquette
var $_Char_Size = 10; // Hauteur des caracteres
var $_Line_Height = 10; // Hauteur par defaut d'une ligne
var $_Metric = 'mm'; // Type of metric.. Will help to calculate good values
var $_Metric_Doc = 'mm'; // Type of metric for the doc..
var $_COUNTX = 1;
var $_COUNTY = 1;
var $_First = 1;
var $Tformat;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
}
/**
* Function to build PDF on disk, then output on HTTP strem.
*
* @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $outputdir Output directory for pdf file
* @return int 1=OK, 0=KO
*/
abstract function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir='');
/**
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
*
* @param PDF $pdf PDF reference
* @param Translate $outputlangs Output langs
* @param array $param Associative array containing label content and optional parameters
* @return void
*/
abstract function addSticker(&$pdf,$outputlangs,$param);
/**
* Methode qui permet de modifier la taille des caracteres
* Cela modiera aussi l'espace entre chaque ligne
*
* @param PDF $pdf PDF reference
* @param int $pt point
* @return void
*/
function Set_Char_Size(&$pdf,$pt)
{
if ($pt > 3) {
$this->_Char_Size = $pt;
$this->_Line_Height = $this->_Get_Height_Chars($pt);
$pdf->SetFont('','',$pt);
}
}
/**
* protected Print dot line
*
* @param PDF $pdf PDF reference
* @param int $x1 X1
* @param int $y1 Y1
* @param int $x2 X2
* @param int $y2 Y2
* @param int $epaisseur Epaisseur
* @param int $nbPointilles Nb pointilles
* @return void
*/
function _Pointille(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles=15)
{
$pdf->SetLineWidth($epaisseur);
$length=abs($x1-$x2);
$hauteur=abs($y1-$y2);
if($length>$hauteur) {
$Pointilles=($length/$nbPointilles)/2; // taille des pointilles
}
else {
$Pointilles=($hauteur/$nbPointilles)/2;
}
for($i=$x1;$i<=$x2;$i+=$Pointilles+$Pointilles) {
for($j=$i;$j<=($i+$Pointilles);$j++) {
if($j<=($x2-1)) {
$pdf->Line($j,$y1,$j+1,$y1); // on trace le pointill? du haut, point par point
$pdf->Line($j,$y2,$j+1,$y2); // on trace le pointill? du bas, point par point
}
}
}
for($i=$y1;$i<=$y2;$i+=$Pointilles+$Pointilles) {
for($j=$i;$j<=($i+$Pointilles);$j++) {
if($j<=($y2-1)) {
$pdf->Line($x1,$j,$x1,$j+1); // on trace le pointill? du haut, point par point
$pdf->Line($x2,$j,$x2,$j+1); // on trace le pointill? du bas, point par point
}
}
}
}
/**
* protected Function realisant une croix aux 4 coins des cartes
*
* @param PDF $pdf PDF reference
* @param int $x1 X1
* @param int $y1 Y1
* @param int $x2 X2
* @param int $y2 Y2
* @param int $epaisseur Epaisseur
* @param int $taille Size
* @return void
*/
function _Croix(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=4)
{
$pdf->SetDrawColor(192,192,192);
$pdf->SetLineWidth($epaisseur);
$lg=$taille/2;
// croix haut gauche
$pdf->Line($x1,$y1-$lg,$x1,$y1+$lg);
$pdf->Line($x1-$lg,$y1,$x1+$lg,$y1);
// croix bas gauche
$pdf->Line($x1,$y2-$lg,$x1,$y2+$lg);
$pdf->Line($x1-$lg,$y2,$x1+$lg,$y2);
// croix haut droit
$pdf->Line($x2,$y1-$lg,$x2,$y1+$lg);
$pdf->Line($x2-$lg,$y1,$x2+$lg,$y1);
// croix bas droit
$pdf->Line($x2,$y2-$lg,$x2,$y2+$lg);
$pdf->Line($x2-$lg,$y2,$x2+$lg,$y2);
$pdf->SetDrawColor(0,0,0);
}
/**
* protected Convert units (in to mm, mm to in)
* $src and $dest must be 'in' or 'mm'
*
* @param int $value value
* @param string $src from
* @param string $dest to
* @return float value value after conversion
*/
function _Convert_Metric ($value, $src, $dest)
{
if ($src != $dest) {
$tab['in'] = 39.37008;
$tab['mm'] = 1000;
return $value * $tab[$dest] / $tab[$src];
} else {
return $value;
}
}
/**
* protected Give the height for a char size given.
*
* @param int $pt Point
* @return int Height chars
*/
function _Get_Height_Chars($pt)
{
// Tableau de concordance entre la hauteur des caracteres et de l'espacement entre les lignes
$_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>3.5, 10=>4, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10);
if (in_array($pt, array_keys($_Table_Hauteur_Chars))) {
return $_Table_Hauteur_Chars[$pt];
} else {
return 100; // There is a prob..
}
}
/**
* protected Set format
*
* @param PDF $pdf PDF reference
* @param string $format Format
* @return void
*/
function _Set_Format(&$pdf, $format)
{
$this->_Metric = $format['metric'];
$this->_Avery_Name = $format['name'];
$this->_Avery_Code = $format['code'];
$this->_Margin_Left = $this->_Convert_Metric($format['marginLeft'], $this->_Metric, $this->_Metric_Doc);
$this->_Margin_Top = $this->_Convert_Metric($format['marginTop'], $this->_Metric, $this->_Metric_Doc);
$this->_X_Space = $this->_Convert_Metric($format['SpaceX'], $this->_Metric, $this->_Metric_Doc);
$this->_Y_Space = $this->_Convert_Metric($format['SpaceY'], $this->_Metric, $this->_Metric_Doc);
$this->_X_Number = $format['NX'];
$this->_Y_Number = $format['NY'];
$this->_Width = $this->_Convert_Metric($format['width'], $this->_Metric, $this->_Metric_Doc);
$this->_Height = $this->_Convert_Metric($format['height'], $this->_Metric, $this->_Metric_Doc);
$this->Set_Char_Size($pdf, $format['font-size']);
}
}

View File

@ -160,7 +160,7 @@ class DolEditor
{
$found=1;
//$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'" cols="'.$this->cols.'"'.($this->readonly?' disabled="disabled"':'').' class="flat">';
$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'"'.(preg_match('/%/',$this->cols)?' style="width: '.$this->cols.'"':' cols="'.$this->cols.'"').' class="flat">';
$out.= '<textarea id="'.$this->htmlname.'" name="'.$this->htmlname.'" rows="'.$this->rows.'"'.(preg_match('/%/',$this->cols)?' style="margin-top: 2px; width: '.$this->cols.'"':' cols="'.$this->cols.'"').' class="flat">';
$out.= $this->content;
$out.= '</textarea>';

View File

@ -107,7 +107,7 @@ class ExtraFields
* @param string $label label of attribute
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour')
* @param int $pos Position of attribute
* @param int $size Size/length of attribute
* @param string $size Size/length of attribute
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
@ -128,7 +128,7 @@ class ExtraFields
// Create field into database except for separator type which is not stored in database
if ($type != 'separate')
{
$result=$this->create($attrname,$type,$size,$elementtype, $unique, $required, $default_value, $param, $perms, $list);
$result=$this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list);
}
$err1=$this->errno;
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
@ -156,7 +156,7 @@ class ExtraFields
*
* @param string $attrname code of attribute
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour')
* @param int $length Size/length of attribute
* @param string $length Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not
@ -233,7 +233,7 @@ class ExtraFields
* @param string $label label of attribute
* @param int $type Type of attribute ('int', 'text', 'varchar', 'date', 'datehour', 'float')
* @param int $pos Position of attribute
* @param int $size Size/length of attribute
* @param string $size Size/length of attribute ('5', '24,8', ...)
* @param string $elementtype Element type ('member', 'product', 'thirdparty', ...)
* @param int $unique Is field unique or not
* @param int $required Is field required or not

View File

@ -4407,13 +4407,15 @@ class Form
* @param array $selected Array with key+value preselected
* @param int $key_in_label 1 pour afficher la key dans la valeur "[key] value"
* @param int $value_as_key 1 to use value as key
* @param string $option Valeur de l'option en fonction du type choisi
* @param string $morecss Add more css style
* @param int $translate Translate and encode value
* @param int $width Force width of select box. May be used only when using jquery couch.
* @param int $width Force width of select box. May be used only when using jquery couch. Example: 250, 95%
* @param string $moreattrib Add more options on select component. Example: 'disabled="disabled"'
* @param string $elemtype Type of element we show ('category', ...)
* @return string HTML multiselect string
* @see selectarray
*/
static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $option='', $translate=0, $width=0)
static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='',$elemtype='')
{
global $conf, $langs;
@ -4423,8 +4425,36 @@ class Form
$tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT;
print '<!-- JS CODE TO ENABLE '.$tmpplugin.' for id '.$htmlname.' -->
<script type="text/javascript">
function formatResult(record) {'."\n";
if ($elemtype == 'category')
{
print ' //return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\';
return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';';
}
else
{
print 'return record.text;';
}
print ' };
function formatSelection(record) {'."\n";
if ($elemtype == 'category')
{
print ' //return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> <a href="'.DOL_URL_ROOT.'/categories/viewcat.php?type=0&id=\'+record.id+\'">\'+record.text+\'</a></span>\';
return \'<span><img src="'.DOL_URL_ROOT.'/theme/eldy/img/object_category.png'.'"> \'+record.text+\'</span>\';';
}
else
{
print 'return record.text;';
}
print ' };
$(document).ready(function () {
$(\'#'.$htmlname.'\').'.$tmpplugin.'({
// Specify format function for dropdown item
formatResult: formatResult,
templateResult: formatResult, /* For 4.0 */
// Specify format function for selected item
formatSelection: formatSelection,
templateResult: formatSelection /* For 4.0 */
});
});
</script>';
@ -4433,7 +4463,7 @@ class Form
// Try also magic suggest
// Add data-role="none" to disable jmobile decoration
$out = '<select data-role="none" id="'.$htmlname.'" class="multiselect" multiple="multiple" name="'.$htmlname.'[]"'.$option.($width?' style="width: '.$width.'px"':'').'>'."\n";
$out = '<select data-role="none" id="'.$htmlname.'" class="multiselect'.($morecss?' '.$morecss:'').'" multiple="multiple" name="'.$htmlname.'[]"'.($moreattrib?' '.$moreattrib:'').($width?' style="width: '.(preg_match('/%/',$width)?$width:$width.'px').'"':'').'>'."\n";
if (is_array($array) && ! empty($array))
{
if ($value_as_key) $array=array_combine($array, $array);
@ -4462,6 +4492,49 @@ class Form
}
/**
* Render list of categories linked to object with id $id and type $type
*
* @param int $id Id of object
* @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact'). Old mode (0, 1, 2, ...) is deprecated.
* @param int $rendermode 0=Default, use multiselect. 1=Use text with link
* @return mixed Array of category objects or < 0 if KO
*/
function showCategories($id, $type, $rendermode=0)
{
global $db;
$cat = new Categorie($db);
$categories = $cat->containing($id, $type);
if ($rendermode == 1)
{
$toprint = array();
foreach($categories as $c)
{
$ways = $c->print_all_ways();
foreach($ways as $way)
{
$toprint[] = img_object('','category').' '.$way;
}
}
return implode('<br>', $toprint);
}
if ($rendermode == 0)
{
$cate_arbo = $this->select_all_categories(0, '', 'parent', 64, 0, 1);
foreach($categories as $c) {
$arrayselected[] = $c->id;
}
return $this->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%', 'disabled="disabled"', 'category');
}
return 'ErrorBadValueForParameterRenderMode'; // Should not happened
}
/**
* Return an html string with a select combo box to choose yes or no
*

View File

@ -773,20 +773,22 @@ class FormOther
}
/**
* Return HTML combo list of month
* Return HTML combo list of month
*
* @param string $selected Preselected value
* @param string $htmlname Nom de la zone select
* @param int $useempty Affiche valeur vide dans liste
* @return string
* @param string $selected Preselected value
* @param string $htmlname Name of HTML select object
* @param int $useempty Show empty in list
* @param int $longlabel Show long label
* @return string
*/
function select_month($selected='',$htmlname='monthid',$useempty=0)
function select_month($selected='',$htmlname='monthid',$useempty=0,$longlabel=0)
{
global $langs;
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$montharray = monthArray($langs, 1); // Get array
if ($longlabel) $montharray = monthArray($langs, 0); // Get array
else $montharray = monthArray($langs, 1);
$select_month = '<select class="flat" name="'.$htmlname.'" id="'.$htmlname.'">';
if ($useempty)

View File

@ -45,8 +45,12 @@ function expensereport_prepare_head($object)
// $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'expensereport');
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
$head[$h][0] = DOL_URL_ROOT.'/expensereport/document.php?id='.$object->id;
$head[$h][1] = $langs->trans("Documents");
$head[$h][1] = $langs->trans('Documents');
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
$head[$h][2] = 'documents';
$h++;

View File

@ -111,7 +111,7 @@ $_Avery_Labels = array (
'marginTop'=>15,
'NX'=>2,
'NY'=>7,
'SpaceX'=>25,
'SpaceX'=>2.5,
'SpaceY'=>0,
'width'=>99.1,
'height'=>38.1,

View File

@ -1649,7 +1649,7 @@ function isValidEmail($address, $acceptsupervisorkey=0)
/**
* Return true if phone number syntax is ok
* TODO Decide what to do with this
*
*
* @param string $phone phone (Ex: "0601010101")
* @return boolean true if phone syntax is OK, false if KO or empty string
*/
@ -2474,10 +2474,11 @@ function info_admin($text, $infoonimgalt = 0, $nodiv=0)
*
* @param DoliDB $db Database handler
* @param mixed $error String or array of errors strings to show
* @param array $errors Array of errors
* @return void
* @see dol_htmloutput_errors
*/
function dol_print_error($db='',$error='')
function dol_print_error($db='',$error='',$errors=null)
{
global $conf,$langs,$argv;
global $dolibarr_main_prod;
@ -2550,12 +2551,15 @@ function dol_print_error($db='',$error='')
$syslog.=", db_error=".$db->lasterror();
}
if ($error)
if ($error || $errors)
{
$langs->load("errors");
if (is_array($error)) $errors=$error;
else $errors=array($error);
// Merge all into $errors array
if (is_array($error) && is_array($errors)) $errors=array_merge($error,$errors);
elseif (is_array($error)) $errors=$error;
elseif (is_array($errors)) $errors=array_merge(array($error),$errors);
else $errors=array_merge(array($error));
foreach($errors as $msg)
{
@ -2564,7 +2568,7 @@ function dol_print_error($db='',$error='')
{
$out.="<b>".$langs->trans("Message").":</b> ".$msg."<br>\n" ;
}
else // Mode CLI
else // Mode CLI
{
$out.='> '.$langs->transnoentities("Message").":\n".$msg."\n" ;
}

View File

@ -57,13 +57,14 @@ function product_prepare_head($object)
}
// Show category tab
/* No more required. Replaced with new multiselect component
if (! empty($conf->categorie->enabled) && $user->rights->categorie->lire)
{
$head[$h][0] = DOL_URL_ROOT."/categories/categorie.php?id=".$object->id.'&type=0';
$head[$h][1] = $langs->trans('Categories');
$head[$h][2] = 'category';
$h++;
}
}*/
// Multilangs
if (! empty($conf->global->MAIN_MULTILANGS))

View File

@ -0,0 +1,252 @@
<?php
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2015 Francis Appels <francis.appels@yahoo.com>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/modules/barcode/doc/tcpdfbarcode.modules.php
* \ingroup barcode
* \brief File of class to manage barcode numbering with tcpdf library
*/
require_once DOL_DOCUMENT_ROOT.'/core/modules/barcode/modules_barcode.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // This is to include def like $genbarcode_loc and $font_loc
/**
* Class to generate barcode images using tcpdf barcode generator
*/
class modTcpdfbarcode extends ModeleBarCode
{
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
var $error='';
var $is2d = false;
/**
* Return description of numbering model
*
* @return string Text with description
*/
function info()
{
global $langs;
return 'TCPDF-barcode';
}
/**
* Return if a module can be used or not
*
* @return boolean true if module can be used
*/
function isEnabled()
{
return true;
}
/**
* Test si les numeros deja en vigueur dans la base ne provoquent pas de
* de conflits qui empechera cette numerotation de fonctionner.
*
* @return boolean false si conflit, true si ok
*/
function canBeActivated()
{
global $langs;
return true;
}
/**
* Return true if encoding is supported
*
* @param string $encoding Encoding norm
* @return int >0 if supported, 0 if not
*/
function encodingIsSupported($encoding)
{
$tcpdfEncoding = $this->getTcpdfEncodingType($encoding);
if (empty($tcpdfEncoding)) {
return 0;
} else {
return 1;
}
}
/**
* Return an image file on the fly (no need to write on disk)
*
* @param String $code Value to encode
* @param String $encoding Mode of encoding
* @param String $readable Code can be read
* @return int <0 if KO, >0 if OK
*/
function buildBarCode($code,$encoding,$readable='Y')
{
global $_GET;
$tcpdfEncoding = $this->getTcpdfEncodingType($encoding);
if (empty($tcpdfEncoding)) return -1;
$color = array(0,0,0);
$_GET["code"]=$code;
$_GET["type"]=$encoding;
$_GET["height"]=$height;
$_GET["readable"]=$readable;
if ($code) {
// Load the tcpdf barcode class
if ($this->is2d) {
$height = 3;
$width = 3;
require_once TCPDF_PATH.'tcpdf_barcodes_2d.php';
$barcodeobj = new TCPDF2DBarcode($code, $tcpdfEncoding);
} else {
$height = 50;
$width = 1;
require_once TCPDF_PATH.'tcpdf_barcodes_1d.php';
$barcodeobj = new TCPDFBarcode($code, $tcpdfEncoding);
}
dol_syslog("buildBarCode::TCPDF.getBarcodePNG");
$barcodeobj->getBarcodePNG($width, $height, $color);
return 1;
} else {
return -2;
}
}
/**
* Save an image file on disk (with no output)
*
* @param String $code Value to encode
* @param String $encoding Mode of encoding
* @param String $readable Code can be read
* @return int <0 if KO, >0 if OK
*/
function writeBarCode($code,$encoding,$readable='Y')
{
global $conf,$_GET;
dol_mkdir($conf->barcode->dir_temp);
$file=$conf->barcode->dir_temp.'/barcode_'.$code.'_'.$encoding.'.png';
$tcpdfEncoding = $this->getTcpdfEncodingType($encoding);
if (empty($tcpdfEncoding)) return -1;
$color = array(0,0,0);
$_GET["code"]=$code;
$_GET["type"]=$encoding;
$_GET["height"]=$height;
$_GET["readable"]=$readable;
if ($code) {
// Load the tcpdf barcode class
if ($this->is2d) {
$height = 1;
$width = 1;
require_once TCPDF_PATH.'tcpdf_barcodes_2d.php';
$barcodeobj = new TCPDF2DBarcode($code, $tcpdfEncoding);
} else {
$height = 50;
$width = 1;
require_once TCPDF_PATH.'tcpdf_barcodes_1d.php';
$barcodeobj = new TCPDFBarcode($code, $tcpdfEncoding);
}
dol_syslog("writeBarCode::TCPDF.getBarcodePngData");
if ($imageData = $barcodeobj->getBarcodePngData($width, $height, $color)) {
if (function_exists('imagecreate')) {
$imageData = imagecreatefromstring($imageData);
}
if (imagepng($imageData, $file)) {
return 1;
} else {
return -3;
}
} else {
return -4;
}
} else {
return -2;
}
}
/**
* get available output_modes for tcpdf class wth its translated description
*
* @param string $dolEncodingType dolibarr barcode encoding type
* @return string tcpdf encoding type
*/
public function getTcpdfEncodingType($dolEncodingType)
{
$tcpdf1dEncodingTypes = array(
'C39' => 'C39',
'C39+' => 'C39+',
'C39E' => 'C39E',
'C39E+' => 'C39E+',
'S25' => 'S25',
'S25+' => 'S25+',
'I25' => 'I25',
'I25+' => 'I25+',
'C128' => 'C128',
'C128A' => 'C128A',
'C128B' => 'C128B',
'C128C' => 'C128C',
'EAN2' => 'EAN2',
'EAN5' => 'EAN5',
'EAN8' => 'EAN8',
'EAN13' => 'EAN13',
'ISBN' => 'EAN13',
'UPC' => 'UPCA',
'UPCE' => 'UPCE',
'MSI' => 'MSI',
'MSI+' => 'MSI+',
'POSTNET' => 'POSTNET',
'PLANET' => 'PLANET',
'RMS4CC' => 'RMS4CC',
'KIX' => 'KIX',
'IMB' => 'IMB',
'CODABAR' => 'CODABAR',
'CODE11' => 'CODE11',
'PHARMA' => 'PHARMA',
'PHARMA2T' => 'PHARMA2T'
);
$tcpdf2dEncodingTypes = array(
'DATAMATRIX' => 'DATAMATRIX',
'PDF417' => 'PDF417',
'QRCODE' => 'QRCODE,L',
'QRCODE,L' => 'QRCODE,L',
'QRCODE,M' => 'QRCODE,M',
'QRCODE,Q' => 'QRCODE,Q',
'QRCODE,H' => 'QRCODE,H'
);
if (array_key_exists($dolEncodingType, $tcpdf1dEncodingTypes)) {
$this->is2d = false;
return $tcpdf1dEncodingTypes[$dolEncodingType];
} else if (array_key_exists($dolEncodingType, $tcpdf2dEncodingTypes)) {
$this->is2d = true;
return $tcpdf2dEncodingTypes[$dolEncodingType];
} else {
return '';
}
}
}

View File

@ -30,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/contract/modules_contract.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
/**
@ -253,6 +254,7 @@ class pdf_strato extends ModelePDFContract
$objectligne = $object->lines[$i];
$valide = $objectligne->id ? $objectligne->fetch($objectligne->id) : 0;
if ($valide > 0 || $object->specimen)
{
$curX = $this->posxdesc-1;
@ -278,12 +280,20 @@ class pdf_strato extends ModelePDFContract
$durationi = $langs->trans("Unknown");
}
$txtpredefinedservice='';
$txtpredefinedservice = $objectligne->product_ref;
if ($objectligne->product_label)
{
$txtpredefinedservice .= ' - ';
$txtpredefinedservice .= $objectligne->product_label;
}
$txt='<strong>'.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".$datei." - ".$outputlangs->transnoentities("Duration")." : ".$durationi,1,$outputlangs->charset_output).'</strong>';
$desc=dol_htmlentitiesbr($objectligne->desc,1);
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0);
$pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,dol_concatdesc($txtpredefinedservice,$desc)), 0, 1, 0);
$nexY = $pdf->GetY();
$nexY = $pdf->GetY() + 2;
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);

View File

@ -2,8 +2,9 @@
/* Copyright (C) 2003 Steve Dillon
* Copyright (C) 2003 Laurent Passebecq
* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Francis Appels <francis.appels@yahoo.com>
*
* 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
@ -12,129 +13,61 @@
*
* 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
* 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, see <http://www.gnu.org/licenses/>.
*/
/* Inspire de PDF_Label
* PDF_Label - PDF label editing
* @package PDF_Label
* @author Laurent PASSEBECQ <lpasseb@numericable.fr>
* @copyright 2003 Laurent PASSEBECQ
* disponible ici : http://www.fpdf.org/fr/script/script29.php
*/
//-------------------------------------------------------------------
// VERSIONS :
// 1.0 : Initial release
// 1.1 : + : Added unit in the constructor
// + : Now Positions start @ (1,1).. then the first image @top-left of a page is (1,1)
// + : Added in the description of a label :
// font-size : defaut char size (can be changed by calling Set_Char_Size(xx);
// paper-size : Size of the paper for this sheet (thanx to Al Canton)
// metric : type of unit used in this description
// You can define your label properties in inches by setting metric to 'in'
// and printing in millimiter by setting unit to 'mm' in constructor.
// Added some labels :
// 5160, 5161, 5162, 5163,5164 : thanx to Al Canton : acanton@adams-blake.com
// 8600 : thanx to Kunal Walia : kunal@u.washington.edu
// + : Added 3mm to the position of labels to avoid errors
////////////////////////////////////////////////////
/**
* \file htdocs/core/modules/member/doc/pdf_standard.class.php
* \ingroup member
* \brief Fichier de la classe permettant d'editer au format PDF des etiquettes au format Avery ou personnalise
* \file htdocs/core/modules/member/doc/pdf_standard.class.php
* \ingroup member
* \brief Fichier de la classe permettant d'editer au format PDF des etiquettes au format Avery ou personnalise
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonstickergenerator.class.php';
/**
* Class to generate stick sheet with format Avery or other personalised
*/
class pdf_standard
class pdf_standard extends CommonStickerGenerator
{
var $code; // Code of format
var $format; // Array with informations
// Proprietes privees
var $_Avery_Name = ''; // Nom du format de l'etiquette
var $_Margin_Left = 0; // Marge de gauche de l'etiquette
var $_Margin_Top = 0; // marge en haut de la page avant la premiere etiquette
var $_X_Space = 0; // Espace horizontal entre 2 bandes d'etiquettes
var $_Y_Space = 0; // Espace vertical entre 2 bandes d'etiquettes
var $_X_Number = 0; // NX Nombre d'etiquettes sur la largeur de la page
var $_Y_Number = 0; // NY Nombre d'etiquettes sur la hauteur de la page
var $_Width = 0; // Largeur de chaque etiquette
var $_Height = 0; // Hauteur de chaque etiquette
var $_Char_Size = 10; // Hauteur des caracteres
var $_Line_Height = 10; // Hauteur par defaut d'une ligne
var $_Metric = 'mm'; // Type of metric.. Will help to calculate good values
var $_Metric_Doc = 'mm'; // Type of metric for the doc..
var $_COUNTX = 1;
var $_COUNTY = 1;
var $_First = 1;
/**
* Constructor
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
*
* @param DoliDB $db Database handler
* @param PDF $pdf PDF reference
* @param Translate $outputlangs Output langs
* @param array $param Associative array containing label content and optional parameters
* @return void
*/
function __construct($db)
{
$this->db = $db;
function addSticker(&$pdf,$outputlangs,$param) {
// use this method in future refactoring
}
/**
* Methode qui permet de modifier la taille des caracteres
* Cela modiera aussi l'espace entre chaque ligne
*
* @param PDF $pdf PDF
* @param int $pt point
* @return void
*/
function Set_Char_Size(&$pdf,$pt)
{
if ($pt > 3) {
$this->_Char_Size = $pt;
$this->_Line_Height = $this->_Get_Height_Chars($pt);
$pdf->SetFont('','',$pt);
}
}
/**
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
* - %LOGO% is replace with company logo
* - %PHOTO% is replace with photo provided as parameter
*
* @param PDF $pdf PDF
* @param string $textleft Text left
* @param string $header Header
* @param string $footer Footer
* @param Translate $outputlangs Output langs
* @param string $textright Text right
* @param int $idmember Id member
* @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text)
* @return void
* @param PDF $pdf PDF
* @param string $textleft Text left
* @param string $header Header
* @param string $footer Footer
* @param Translate $outputlangs Output langs
* @param string $textright Text right
* @param int $idmember Id member
* @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text)
* @return void
*/
function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$idmember=0,$photo='')
{
global $mysoc,$conf,$langs;
global $forceimgscalewidth,$forceimgscaleheight;
$imgscalewidth=(empty($forceimgscalewidth)?0.3:$forceimgscalewidth); // Scale of image for width (1=Full width of sticker)
$imgscaleheight=(empty($forceimgscalewidth)?0.5:$forceimgscalewidth); // Scale of image for height (1=Full height of sticker)
$imgscalewidth=(empty($forceimgscalewidth)?0.3:$forceimgscalewidth); // Scale of image for width (1=Full width of sticker)
$imgscaleheight=(empty($forceimgscalewidth)?0.5:$forceimgscalewidth); // Scale of image for height (1=Full height of sticker)
// We are in a new page, then we must add a page
if (($this->_COUNTX ==0) && ($this->_COUNTY==0) and (!$this->_First==1)) {
@ -297,151 +230,14 @@ class pdf_standard
}
}
/**
* Print dot line
*
* @param PDF $pdf PDF
* @param int $x1 X1
* @param int $y1 Y1
* @param int $x2 X2
* @param int $y2 Y2
* @param int $epaisseur Epaisseur
* @param int $nbPointilles Nb pointilles
* @return void
*/
function _Pointille(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles=15)
{
$pdf->SetLineWidth($epaisseur);
$length=abs($x1-$x2);
$hauteur=abs($y1-$y2);
if($length>$hauteur) {
$Pointilles=($length/$nbPointilles)/2; // taille des pointilles
}
else {
$Pointilles=($hauteur/$nbPointilles)/2;
}
for($i=$x1;$i<=$x2;$i+=$Pointilles+$Pointilles) {
for($j=$i;$j<=($i+$Pointilles);$j++) {
if($j<=($x2-1)) {
$pdf->Line($j,$y1,$j+1,$y1); // on trace le pointill? du haut, point par point
$pdf->Line($j,$y2,$j+1,$y2); // on trace le pointill? du bas, point par point
}
}
}
for($i=$y1;$i<=$y2;$i+=$Pointilles+$Pointilles) {
for($j=$i;$j<=($i+$Pointilles);$j++) {
if($j<=($y2-1)) {
$pdf->Line($x1,$j,$x1,$j+1); // on trace le pointill? du haut, point par point
$pdf->Line($x2,$j,$x2,$j+1); // on trace le pointill? du bas, point par point
}
}
}
}
/**
* Fonction realisant une croix aux 4 coins des cartes
*
* @param PDF $pdf PDF
* @param int $x1 X1
* @param int $y1 Y1
* @param int $x2 X2
* @param int $y2 Y2
* @param int $epaisseur Epaisseur
* @param int $taille Size
* @return void
*/
function _Croix(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=4)
{
$pdf->SetDrawColor(192,192,192);
$pdf->SetLineWidth($epaisseur);
$lg=$taille/2;
// croix haut gauche
$pdf->Line($x1,$y1-$lg,$x1,$y1+$lg);
$pdf->Line($x1-$lg,$y1,$x1+$lg,$y1);
// croix bas gauche
$pdf->Line($x1,$y2-$lg,$x1,$y2+$lg);
$pdf->Line($x1-$lg,$y2,$x1+$lg,$y2);
// croix haut droit
$pdf->Line($x2,$y1-$lg,$x2,$y1+$lg);
$pdf->Line($x2-$lg,$y1,$x2+$lg,$y1);
// croix bas droit
$pdf->Line($x2,$y2-$lg,$x2,$y2+$lg);
$pdf->Line($x2-$lg,$y2,$x2+$lg,$y2);
$pdf->SetDrawColor(0,0,0);
}
/**
* Convert units (in to mm, mm to in)
* $src and $dest must be 'in' or 'mm'
*
* @param int $value value
* @param string $src from
* @param string $dest to
* @return float value value after conversion
*/
function _Convert_Metric ($value, $src, $dest)
{
if ($src != $dest) {
$tab['in'] = 39.37008;
$tab['mm'] = 1000;
return $value * $tab[$dest] / $tab[$src];
} else {
return $value;
}
}
/**
* Give the height for a char size given.
*
* @param int $pt Point
* @return int Height chars
*/
function _Get_Height_Chars($pt)
{
// Tableau de concordance entre la hauteur des caracteres et de l'espacement entre les lignes
$_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>3.5, 10=>4, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10);
if (in_array($pt, array_keys($_Table_Hauteur_Chars))) {
return $_Table_Hauteur_Chars[$pt];
} else {
return 100; // There is a prob..
}
}
/**
* Set format
*
* @param PDF $pdf PDF
* @param string $format Format
* @return void
*/
function _Set_Format(&$pdf, $format)
{
$this->_Metric = $format['metric'];
$this->_Avery_Name = $format['name'];
$this->_Avery_Code = $format['code'];
$this->_Margin_Left = $this->_Convert_Metric($format['marginLeft'], $this->_Metric, $this->_Metric_Doc);
$this->_Margin_Top = $this->_Convert_Metric($format['marginTop'], $this->_Metric, $this->_Metric_Doc);
$this->_X_Space = $this->_Convert_Metric($format['SpaceX'], $this->_Metric, $this->_Metric_Doc);
$this->_Y_Space = $this->_Convert_Metric($format['SpaceY'], $this->_Metric, $this->_Metric_Doc);
$this->_X_Number = $format['NX'];
$this->_Y_Number = $format['NY'];
$this->_Width = $this->_Convert_Metric($format['width'], $this->_Metric, $this->_Metric_Doc);
$this->_Height = $this->_Convert_Metric($format['height'], $this->_Metric, $this->_Metric_Doc);
$this->Set_Char_Size($pdf, $format['font-size']);
}
/**
* Function to build PDF on disk, then output on HTTP strem.
*
* @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ...'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $mode Tell if doc module is called for 'member', ...
* @return int 1=OK, 0=KO
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $mode Tell if doc module is called for 'member', ...
* @return int 1=OK, 0=KO
*/
function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$mode='member')
{
@ -465,8 +261,8 @@ class pdf_standard
if (empty($mode) || $mode == 'member')
{
$title=$outputlangs->transnoentities('MembersCards');
$keywords=$outputlangs->transnoentities('MembersCards')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name);
$title=$outputlangs->transnoentities('MembersCards');
$keywords=$outputlangs->transnoentities('MembersCards')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name);
$outputdir=$conf->adherent->dir_temp;
}
else
@ -488,14 +284,14 @@ class pdf_standard
}
}
$pdf=pdf_getInstance($this->format,$this->Tformat['metric']);
$pdf=pdf_getInstance($this->format,$this->Tformat['metric']);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
$pdf->SetTitle($title);
$pdf->SetSubject($title);
@ -548,7 +344,7 @@ class pdf_standard
$type=dol_mimetype($filename);
//if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type);
if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -11,7 +11,7 @@
*
* 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
* 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
@ -20,9 +20,9 @@
*/
/**
* \file htdocs/core/modules/member/modules_cards.php
* \ingroup member
* \brief File of parent class of document generator for members cards.
* \file htdocs/core/modules/member/modules_cards.php
* \ingroup member
* \brief File of parent class of document generator for members cards.
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
@ -38,11 +38,11 @@ class ModelePDFCards
/**
* Return list of active generation modules
* Return list of active generation modules
*
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
* @param DoliDB $db Database handler
* @param integer $maxfilenamelength Max length of value to show
* @return array List of templates
*/
function liste_modeles($db,$maxfilenamelength=0)
{
@ -62,13 +62,15 @@ class ModelePDFCards
/**
* Cree un fichier de cartes de visites en fonction du modele de ADHERENT_CARDS_ADDON_PDF
*
* @param DoliDB $db Database handler
* @param array $arrayofmembers Array of members
* @param DoliDB $db Database handler
* @param array $arrayofmembers Array of members
* @param string $modele Force modele to use ('' to not force)
* @param Translate $outputlangs Objet langs to use for translation
* @return int <0 if KO, >0 if OK
* @param Translate $outputlangs Object langs to use for translation
* @param string $outputdir Output directory
* @param string $template pdf generenate document class to use default 'standard'
* @return int <0 if KO, >0 if OK
*/
function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs)
function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $outputdir='', $template='standard')
{
global $conf,$langs;
$langs->load("members");
@ -97,13 +99,12 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs)
}
}
else $code=$modele;
$modele='standard';
// If selected modele is a filename template (then $modele="modelname:filename")
$tmp=explode(':',$modele,2);
$tmp=explode(':',$template,2);
if (! empty($tmp[1]))
{
$modele=$tmp[0];
$template=$tmp[0];
$srctemplatepath=$tmp[1];
}
else $srctemplatepath=$code;
@ -116,14 +117,14 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs)
{
foreach(array('doc','pdf') as $prefix)
{
$file = $prefix."_".$modele.".class.php";
$file = $prefix."_".$template.".class.php";
// On verifie l'emplacement du modele
$file=dol_buildpath($reldir."core/modules/member/doc/".$file,0);
if (file_exists($file))
{
$filefound=1;
$classname=$prefix.'_'.$modele;
$classname=$prefix.'_'.$template;
break;
}
}

View File

@ -69,7 +69,7 @@ class modAccounting extends DolibarrModules
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module
$this->phpmin = array(5, 3); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3, 6); // Minimum version of Dolibarr required by module
$this->need_dolibarr_version = array(3, 7); // Minimum version of Dolibarr required by module
$this->langfiles = array("accountancy");
// Constants
@ -191,6 +191,11 @@ class modAccounting extends DolibarrModules
"yesno",
"1"
);
$this->const[22] = array(
"ACCOUNTING_EXPENSEREPORT_JOURNAL",
"chaine",
"ER"
);
// Tabs
$this->tabs = array();

View File

@ -81,8 +81,8 @@ class modAdherent extends DolibarrModules
$this->const[21] = array("ADHERENT_MAIL_FROM","chaine","","From des mails");
$this->const[22] = array("ADHERENT_MAIL_COTIS","texte","Bonjour %FIRSTNAME%,\r\nCet email confirme que votre cotisation a été reçue\r\net enregistrée","Mail de validation de cotisation");
$this->const[23] = array("ADHERENT_MAIL_COTIS_SUBJECT","chaine","Reçu de votre cotisation","Sujet du mail de validation de cotisation");
$this->const[25] = array("ADHERENT_CARD_HEADER_TEXT","chaine","%ANNEE%","Texte imprimé sur le haut de la carte adhérent");
$this->const[26] = array("ADHERENT_CARD_FOOTER_TEXT","chaine","Association AZERTY","Texte imprimé sur le bas de la carte adhérent");
$this->const[25] = array("ADHERENT_CARD_HEADER_TEXT","chaine","%YEAR%","Texte imprimé sur le haut de la carte adhérent");
$this->const[26] = array("ADHERENT_CARD_FOOTER_TEXT","chaine","%COMPANY%","Texte imprimé sur le bas de la carte adhérent");
$this->const[27] = array("ADHERENT_CARD_TEXT","texte","%FULLNAME%\r\nID: %ID%\r\n%EMAIL%\r\n%ADDRESS%\r\n%ZIP% %TOWN%\r\n%COUNTRY%","Text to print on member cards");
$this->const[28] = array("ADHERENT_MAILMAN_ADMINPW","chaine","","Mot de passe Admin des liste mailman");
$this->const[31] = array("ADHERENT_BANK_USE_AUTO","yesno","","Insertion automatique des cotisations dans le compte banquaire");

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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
@ -10,7 +10,7 @@
*
* 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
* 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
@ -18,11 +18,11 @@
*/
/**
* \defgroup barcode Module barcode
* \brief Module pour gerer les codes barres
* \file htdocs/core/modules/modBarcode.class.php
* \ingroup barcode,produit
* \brief Fichier de description et activation du module Barcode
* \defgroup barcode Module barcode
* \brief Module pour gerer les codes barres
* \file htdocs/core/modules/modBarcode.class.php
* \ingroup barcode,produit
* \brief Fichier de description et activation du module Barcode
*/
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
@ -34,9 +34,9 @@ class modBarcode extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
* @param DoliDB $db Database handler
*/
function __construct($db)
{
@ -56,7 +56,7 @@ class modBarcode extends DolibarrModules
$this->dirs = array("/barcode/temp");
// Dependances
$this->depends = array(); // May be used for product or service or third party module
$this->depends = array(); // May be used for product or service or third party module
$this->requiredby = array();
// Config pages
@ -64,10 +64,12 @@ class modBarcode extends DolibarrModules
// Constants
// Example: $this->const=array(0=>array('MYMODULE_MYNEWCONST1','chaine','myvalue','This is a constant to add',0),
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );
$this->const = array(
//0=>array('GENBARCODE_LOCATION','chaine',DOL_DOCUMENT_ROOT.'/includes/barcode/genbarcode/genbarcode','Path to genbarcode command line tool',0)
);
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );
$this->const = array();
//$this->const[0] = array('BARCODE_LABEL_LEFT_TEXT','chaine','%BARCODE%','Print barcode on left side of label',1);
//$this->const[1] = array('BARCODE_LABEL_RIGHT_TEXT','chaine','%LOGO%','Print Company logo on right side',1);
//$this->const[2] = array('BARCODE_LABEL_HEADER_TEXT','chaine','My header','Print header text on label',1);
//$this->const[3] = array('BARCODE_LABEL_FOOTER_TEXT','chaine','My footer','Print footer text on label',1);
// Boxes
$this->boxes = array();
@ -88,43 +90,43 @@ class modBarcode extends DolibarrModules
$this->rights[2][3] = 0; // La permission est-elle une permission par defaut
$this->rights[2][4] = 'creer_advance';
// Main menu entries
$r=0;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'mainmenu'=>'tools',
'leftmenu'=>'barcodeprint',
'type'=>'left', // This is a Left menu entry
'titre'=>'BarCodePrintsheet',
'url'=>'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint',
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>200,
'enabled'=>'$conf->barcode->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// Main menu entries
$r=0;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=tools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'mainmenu'=>'tools',
'leftmenu'=>'barcodeprint',
'type'=>'left', // This is a Left menu entry
'titre'=>'BarCodePrintsheet',
'url'=>'/barcode/printsheet.php?mainmenu=tools&leftmenu=barcodeprint',
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>200,
'enabled'=>'$conf->barcode->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
$r++;
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
$this->menu[$r]=array( 'fk_menu'=>'fk_mainmenu=home,fk_leftmenu=modulesadmintools', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
'type'=>'left', // This is a Left menu entry
'titre'=>'MassBarcodeInit',
'url'=>'/barcode/codeinit.php?mainmenu=home&leftmenu=modulesadmintools',
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'langs'=>'products', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>300,
'enabled'=>'$conf->barcode->enabled && $leftmenu=="modulesadmintools"', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'enabled'=>'$conf->barcode->enabled && $leftmenu=="modulesadmintools"', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
'perms'=>'1', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
'target'=>'',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both
$r++;
}
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories.
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
/**
* Function called when module is enabled.
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
* It also creates data directories.
*
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function init($options='')
{
@ -137,25 +139,27 @@ class modBarcode extends DolibarrModules
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('UPC', 'UPC', 0, '123456789012', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('ISBN', 'ISBN', 0, '123456789', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('C39', 'Code 39', 0, '1234567890', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('C128', 'Code 128', 0, 'ABCD1234567890', __ENTITY__)",'ignoreerror'=>1)
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('C128', 'Code 128', 0, 'ABCD1234567890', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('DATAMATRIX', 'Datamatrix', 0, '1234567xyz', __ENTITY__)",'ignoreerror'=>1),
array('sql'=>"INSERT INTO ".MAIN_DB_PREFIX."c_barcode_type (code, libelle, coder, example, entity) VALUES ('QRCODE', 'Qr Code', 0, 'www.dolibarr.org', __ENTITY__)",'ignoreerror'=>1)
);
return $this->_init($sql, $options);
}
/**
/**
* Function called when module is disabled.
* Remove from database constants, boxes and permissions from Dolibarr database.
* 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($options='')
{
* @param string $options Options when enabling module ('', 'noboxes')
* @return int 1 if OK, 0 if KO
*/
function remove($options='')
{
$sql = array();
return $this->_remove($sql, $options);
}
}
}

View File

@ -292,11 +292,9 @@ class modProjet extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet";
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task,";
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'societe as s';
$this->export_sql_end[$r] .=' WHERE p.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' AND p.entity IN ('.getEntity('project',1).')';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task";
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid';
$this->export_sql_end[$r] .=' WHERE p.entity = '.$conf->entity;
}

View File

@ -2,8 +2,9 @@
/* Copyright (C) 2003 Steve Dillon
* Copyright (C) 2003 Laurent Passebecq
* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Francis Appels <francis.appels@yahoo.com>
*
* 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
@ -12,129 +13,61 @@
*
* 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
* 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, see <http://www.gnu.org/licenses/>.
*/
/* Inspire de PDF_Label
* PDF_Label - PDF label editing
* @package PDF_Label
* @author Laurent PASSEBECQ <lpasseb@numericable.fr>
* @copyright 2003 Laurent PASSEBECQ
* disponible ici : http://www.fpdf.org/fr/script/script29.php
*/
//-------------------------------------------------------------------
// VERSIONS :
// 1.0 : Initial release
// 1.1 : + : Added unit in the constructor
// + : Now Positions start @ (1,1).. then the first image @top-left of a page is (1,1)
// + : Added in the description of a label :
// font-size : defaut char size (can be changed by calling Set_Char_Size(xx);
// paper-size : Size of the paper for this sheet (thanx to Al Canton)
// metric : type of unit used in this description
// You can define your label properties in inches by setting metric to 'in'
// and printing in millimiter by setting unit to 'mm' in constructor.
// Added some labels :
// 5160, 5161, 5162, 5163,5164 : thanx to Al Canton : acanton@adams-blake.com
// 8600 : thanx to Kunal Walia : kunal@u.washington.edu
// + : Added 3mm to the position of labels to avoid errors
////////////////////////////////////////////////////
/**
* \file htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php
* \ingroup core
* \brief Fichier de la classe permettant d'editer au format PDF des etiquettes au format Avery ou personnalise
* \file htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php
* \ingroup core
* \brief Fichier de la classe permettant d'editer au format PDF des etiquettes au format Avery ou personnalise
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/commonstickergenerator.class.php';
/**
* Class to generate stick sheet with format Avery or other personalised
*/
class pdf_standardlabel
class pdf_standardlabel extends CommonStickerGenerator
{
var $code; // Code of format
var $format; // Array with informations
// Proprietes privees
var $_Avery_Name = ''; // Nom du format de l'etiquette
var $_Margin_Left = 0; // Marge de gauche de l'etiquette
var $_Margin_Top = 0; // marge en haut de la page avant la premiere etiquette
var $_X_Space = 0; // Espace horizontal entre 2 bandes d'etiquettes
var $_Y_Space = 0; // Espace vertical entre 2 bandes d'etiquettes
var $_X_Number = 0; // NX Nombre d'etiquettes sur la largeur de la page
var $_Y_Number = 0; // NY Nombre d'etiquettes sur la hauteur de la page
var $_Width = 0; // Largeur de chaque etiquette
var $_Height = 0; // Hauteur de chaque etiquette
var $_Char_Size = 10; // Hauteur des caracteres
var $_Line_Height = 10; // Hauteur par defaut d'une ligne
var $_Metric = 'mm'; // Type of metric.. Will help to calculate good values
var $_Metric_Doc = 'mm'; // Type of metric for the doc..
var $_COUNTX = 1;
var $_COUNTY = 1;
var $_First = 1;
/**
* Constructor
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
*
* @param DoliDB $db Database handler
* @param PDF $pdf PDF reference
* @param Translate $outputlangs Output langs
* @param array $param Associative array containing label content and optional parameters
* @return void
*/
function __construct($db)
{
$this->db = $db;
function addSticker(&$pdf,$outputlangs,$param) {
// use this method in future refactoring
}
/**
* Methode qui permet de modifier la taille des caracteres
* Cela modiera aussi l'espace entre chaque ligne
*
* @param PDF $pdf PDF
* @param int $pt point
* @return void
*/
function Set_Char_Size(&$pdf,$pt)
{
if ($pt > 3) {
$this->_Char_Size = $pt;
$this->_Line_Height = $this->_Get_Height_Chars($pt);
$pdf->SetFont('','',$pt);
}
}
/**
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
* - %LOGO% is replace with company logo
* - %PHOTO% is replace with photo provided as parameter
*
* @param PDF $pdf PDF
* @param string $textleft Text left
* @param string $header Header
* @param string $footer Footer
* @param Translate $outputlangs Output langs
* @param string $textright Text right
* @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text)
* @return void
* @param PDF $pdf PDF reference
* @param string $textleft Text left
* @param string $header Header
* @param string $footer Footer
* @param Translate $outputlangs Output langs
* @param string $textright Text right
* @param string $photo Photo (full path to image file used as replacement for key %PHOTOS% into left, right, header or footer text)
* @return void
*/
function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='')
function Add_PDF_label(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$photo='')
{
global $mysoc,$conf,$langs;
global $forceimgscalewidth,$forceimgscaleheight;
$imgscalewidth=(empty($forceimgscalewidth)?0.3:$forceimgscalewidth); // Scale of image for width (1=Full width of sticker)
$imgscaleheight=(empty($forceimgscalewidth)?0.5:$forceimgscalewidth); // Scale of image for height (1=Full height of sticker)
$imgscalewidth=(empty($forceimgscalewidth)?0.3:$forceimgscalewidth); // Scale of image for width (1=Full width of sticker)
$imgscaleheight=(empty($forceimgscalewidth)?0.5:$forceimgscalewidth); // Scale of image for height (1=Full height of sticker)
// We are in a new page, then we must add a page
// We are in a new page, then we must add a page
if (($this->_COUNTX ==0) && ($this->_COUNTY==0) and (!$this->_First==1)) {
$pdf->AddPage();
}
@ -289,257 +222,123 @@ class pdf_standardlabel
}
/**
* Print dot line
*
* @param PDF $pdf PDF
* @param int $x1 X1
* @param int $y1 Y1
* @param int $x2 X2
* @param int $y2 Y2
* @param int $epaisseur Epaisseur
* @param int $nbPointilles Nb pointilles
* @return void
*/
function _Pointille(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles=15)
{
$pdf->SetLineWidth($epaisseur);
$length=abs($x1-$x2);
$hauteur=abs($y1-$y2);
if($length>$hauteur) {
$Pointilles=($length/$nbPointilles)/2; // taille des pointilles
}
else {
$Pointilles=($hauteur/$nbPointilles)/2;
}
for($i=$x1;$i<=$x2;$i+=$Pointilles+$Pointilles) {
for($j=$i;$j<=($i+$Pointilles);$j++) {
if($j<=($x2-1)) {
$pdf->Line($j,$y1,$j+1,$y1); // on trace le pointill? du haut, point par point
$pdf->Line($j,$y2,$j+1,$y2); // on trace le pointill? du bas, point par point
}
}
}
for($i=$y1;$i<=$y2;$i+=$Pointilles+$Pointilles) {
for($j=$i;$j<=($i+$Pointilles);$j++) {
if($j<=($y2-1)) {
$pdf->Line($x1,$j,$x1,$j+1); // on trace le pointill? du haut, point par point
$pdf->Line($x2,$j,$x2,$j+1); // on trace le pointill? du bas, point par point
}
}
}
}
/**
* Fonction realisant une croix aux 4 coins des cartes
* Function to build PDF on disk, then output on HTTP strem.
*
* @param PDF $pdf PDF
* @param int $x1 X1
* @param int $y1 Y1
* @param int $x2 X2
* @param int $y2 Y2
* @param int $epaisseur Epaisseur
* @param int $taille Size
* @return void
*/
function _Croix(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=4)
{
$pdf->SetDrawColor(192,192,192);
$pdf->SetLineWidth($epaisseur);
$lg=$taille/2;
// croix haut gauche
$pdf->Line($x1,$y1-$lg,$x1,$y1+$lg);
$pdf->Line($x1-$lg,$y1,$x1+$lg,$y1);
// croix bas gauche
$pdf->Line($x1,$y2-$lg,$x1,$y2+$lg);
$pdf->Line($x1-$lg,$y2,$x1+$lg,$y2);
// croix haut droit
$pdf->Line($x2,$y1-$lg,$x2,$y1+$lg);
$pdf->Line($x2-$lg,$y1,$x2+$lg,$y1);
// croix bas droit
$pdf->Line($x2,$y2-$lg,$x2,$y2+$lg);
$pdf->Line($x2-$lg,$y2,$x2+$lg,$y2);
$pdf->SetDrawColor(0,0,0);
}
/**
* Convert units (in to mm, mm to in)
* $src and $dest must be 'in' or 'mm'
*
* @param int $value value
* @param string $src from
* @param string $dest to
* @return float value value after conversion
*/
function _Convert_Metric ($value, $src, $dest)
{
if ($src != $dest) {
$tab['in'] = 39.37008;
$tab['mm'] = 1000;
return $value * $tab[$dest] / $tab[$src];
} else {
return $value;
}
}
/**
* Give the height for a char size given.
*
* @param int $pt Point
* @return int Height chars
*/
function _Get_Height_Chars($pt)
{
// Tableau de concordance entre la hauteur des caracteres et de l'espacement entre les lignes
$_Table_Hauteur_Chars = array(6=>2, 7=>2.5, 8=>3, 9=>3.5, 10=>4, 11=>6, 12=>7, 13=>8, 14=>9, 15=>10);
if (in_array($pt, array_keys($_Table_Hauteur_Chars))) {
return $_Table_Hauteur_Chars[$pt];
} else {
return 100; // There is a prob..
}
}
/**
* Set format
*
* @param PDF $pdf PDF
* @param string $format Format
* @return void
*/
function _Set_Format(&$pdf, $format)
{
$this->_Metric = $format['metric'];
$this->_Avery_Name = $format['name'];
$this->_Avery_Code = $format['code'];
$this->_Margin_Left = $this->_Convert_Metric($format['marginLeft'], $this->_Metric, $this->_Metric_Doc);
$this->_Margin_Top = $this->_Convert_Metric($format['marginTop'], $this->_Metric, $this->_Metric_Doc);
$this->_X_Space = $this->_Convert_Metric($format['SpaceX'], $this->_Metric, $this->_Metric_Doc);
$this->_Y_Space = $this->_Convert_Metric($format['SpaceY'], $this->_Metric, $this->_Metric_Doc);
$this->_X_Number = $format['NX'];
$this->_Y_Number = $format['NY'];
$this->_Width = $this->_Convert_Metric($format['width'], $this->_Metric, $this->_Metric_Doc);
$this->_Height = $this->_Convert_Metric($format['height'], $this->_Metric, $this->_Metric_Doc);
$this->Set_Char_Size($pdf, $format['font-size']);
}
/**
* Function to build PDF on disk, then output on HTTP strem.
*
* @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $outputdir Output directory for pdf file
* @return int 1=OK, 0=KO
*/
function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir='')
{
global $user,$conf,$langs,$mysoc,$_Avery_Labels;
* @return int 1=OK, 0=KO
*/
function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir='')
{
global $user,$conf,$langs,$mysoc,$_Avery_Labels;
$this->code=$srctemplatepath;
$this->Tformat = $_Avery_Labels[$this->code];
if (empty($this->Tformat)) { dol_print_error('','ErrorBadTypeForCard'.$this->code); exit; }
$this->type = 'pdf';
$this->format = $this->Tformat['paper-size'];
$this->code=$srctemplatepath;
$this->Tformat = $_Avery_Labels[$this->code];
if (empty($this->Tformat)) { dol_print_error('','ErrorBadTypeForCard'.$this->code); exit; }
$this->type = 'pdf';
$this->format = $this->Tformat['paper-size'];
if (! is_object($outputlangs)) $outputlangs=$langs;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("admin");
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("admin");
$title=$outputlangs->transnoentities('Labels');
$keywords=$title." ".$outputlangs->convToOutputCharset($mysoc->name);
$title=$outputlangs->transnoentities('Labels');
$keywords=$title." ".$outputlangs->convToOutputCharset($mysoc->name);
$dir = (empty($outputdir)?$conf->adherent->dir_temp:$outputdir);
$filename='tmp_address_sheet.pdf';
$file = $dir."/".$filename;
$dir = (empty($outputdir)?$conf->adherent->dir_temp:$outputdir);
$filename='tmp_address_sheet.pdf';
$file = $dir."/".$filename;
if (! file_exists($dir))
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
return 0;
}
}
if (! file_exists($dir))
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
return 0;
}
}
$pdf=pdf_getInstance($this->format,$this->Tformat['metric']);
$pdf=pdf_getInstance($this->format,$this->Tformat['metric']);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
$pdf->SetTitle($title);
$pdf->SetSubject($title);
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($keywords);
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetTitle($title);
$pdf->SetSubject($title);
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($keywords);
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins(0,0);
$pdf->SetAutoPageBreak(false);
$pdf->SetMargins(0,0);
$pdf->SetAutoPageBreak(false);
$this->_Metric_Doc = $this->Tformat['metric'];
// Permet de commencer l'impression de l'etiquette desiree dans le cas ou la page a deja servie
$posX=1;
$posY=1;
if ($posX > 0) $posX--; else $posX=0;
if ($posY > 0) $posY--; else $posY=0;
$this->_COUNTX = $posX;
$this->_COUNTY = $posY;
$this->_Set_Format($pdf, $this->Tformat);
$this->_Metric_Doc = $this->Tformat['metric'];
// Permet de commencer l'impression de l'etiquette desiree dans le cas ou la page a deja servie
$posX=1;
$posY=1;
if ($posX > 0) $posX--; else $posX=0;
if ($posY > 0) $posY--; else $posY=0;
$this->_COUNTX = $posX;
$this->_COUNTY = $posY;
$this->_Set_Format($pdf, $this->Tformat);
$pdf->Open();
$pdf->AddPage();
$pdf->Open();
$pdf->AddPage();
// Add each record
foreach($arrayofrecords as $val)
{
// imprime le texte specifique sur la carte
$this->Add_PDF_card($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['photo']);
}
// Add each record
foreach($arrayofrecords as $val)
{
// imprime le texte specifique sur la carte
$this->Add_PDF_label($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['photo']);
}
//$pdf->SetXY(10, 295);
//$pdf->Cell($this->_Width, $this->_Line_Height, 'XXX',0,1,'C');
//$pdf->SetXY(10, 295);
//$pdf->Cell($this->_Width, $this->_Line_Height, 'XXX',0,1,'C');
// Output to file
$pdf->Output($file,'F');
// Output to file
$pdf->Output($file,'F');
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
// Output to http stream
clearstatcache();
// Output to http stream
clearstatcache();
$attachment=true;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
$type=dol_mimetype($filename);
$attachment=true;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
$type=dol_mimetype($filename);
//if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
//if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
readfile($file);
readfile($file);
return 1;
}
return 1;
}
}

View File

@ -0,0 +1,385 @@
<?php
/* Copyright (C) 2003 Steve Dillon
* Copyright (C) 2003 Laurent Passebecq
* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2015 Francis Appels <francis.appels@yahoo.com>
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php
* \ingroup core
* \brief Fichier de la classe permettant d'editer au format PDF des etiquettes au format Avery ou personnalise
*/
require_once DOL_DOCUMENT_ROOT.'/core/class/commonstickergenerator.class.php';
/**
* Class to generate stick sheet with format Avery or other personalised
*/
class pdf_tcpdflabel extends CommonStickerGenerator
{
// define 1d barcode style
private $_style1d = array(
'position' => '',
'align' => 'C',
'stretch' => false,
'fitwidth' => true,
'cellfitalign' => '',
'border' => false,
'hpadding' => 'auto',
'vpadding' => 'auto',
'fgcolor' => array(0,0,0),
'bgcolor' => false,
'text' => true,
'font' => 'helvetica',
'fontsize' => 8,
'stretchtext' => 4
);
// set style for 2d barcode
private $_style2d = array(
'border' => false,
'vpadding' => 'auto',
'hpadding' => 'auto',
'fgcolor' => array(0,0,0),
'bgcolor' => false,
'module_width' => 1, // width of a single module in points
'module_height' => 1 // height of a single module in points
);
private $_align2d = 'N';
private $_xres = 0.4;
/**
* write barcode to pdf
*
* @param PDF $pdf PDF reference
* @param string $code code to print
* @param string $encoding type of barcode
* @param boolean $is2d true if 2d barcode
* @param int $x x position in user units
* @param int $y y position in user units
* @param int $w width in user units
* @param int $h height in user units
*/
private function writeBarcode(&$pdf, $code, $encoding, $is2d, $x, $y, $w, $h)
{
if ($is2d) {
$pdf->write2DBarcode($code, $encoding, $x, $y, $w, $h, $this->_style2d, $this->_align2d);
} else {
$pdf->write1DBarcode($code, $encoding, $x, $y, $w, $h, $this->_xres, $this->_style1d);
}
}
/**
* Output a sticker on page at position _COUNTX, _COUNTY (_COUNTX and _COUNTY start from 0)
*
* @param PDF $pdf PDF reference
* @param Translate $outputlangs Output langs
* @param array $param Associative array containing label content and optional parameters
* @return void
*/
function addSticker(&$pdf,$outputlangs,$param)
{
global $mysoc,$conf;
$textleft = $param['textleft'];
$header = $param['textheader'];
$footer = $param['textfooter'];
$textright = $param['textright'];
$code = $param['code'];
$encoding = $param['encoding'];
$is2d = $param['is2d'];
// We are in a new page, then we must add a page
if (($this->_COUNTX ==0) && ($this->_COUNTY==0) and (!$this->_First==1)) {
$pdf->AddPage();
}
$this->_First=0;
$_PosX = $this->_Margin_Left+($this->_COUNTX*($this->_Width+$this->_X_Space));
$_PosY = $this->_Margin_Top+($this->_COUNTY*($this->_Height+$this->_Y_Space));
// Define logo
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
if (! is_readable($logo))
{
$logo='';
if (! empty($mysoc->logo_small) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small))
{
$logo=$conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small;
}
elseif (! empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo))
{
$logo=$conf->mycompany->dir_output.'/logos/'.$mysoc->logo;
}
}
$xleft = 2;
$ytop = 2;
// Top
if ($header!='')
{
$pdf->SetXY($_PosX+$xleft, $_PosY+1); // Only 1 mm and not ytop for top text
$pdf->Cell($this->_Width-2*$xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($header),0,1,'C');
}
$ytop += (empty($header)?0:(1+$this->_Line_Height));
// Define widthtouse and heighttouse
$pageMargins = $pdf->getMargins();
$maxwidthtouse = round($this->_Width - 2*$xleft);
$maxheighttouse = round($this->_Height - 2*$ytop);
$maxheighttouse -= (empty($footer)?0:(1+$this->_Line_Height));
$defaultratio = ($maxwidthtouse/$maxheighttouse);
$widthtouse = $maxwidthtouse;
$heighttouse = $maxheighttouse;
$logoHeight = $heighttouse;
$logoWidth = $heighttouse;
//var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit;
// Center
if ($textright=='') // Only a left part
{
// Output left area
if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+$xleft, $_PosY+$ytop, 0, $logoHeight);
else if ($code && !empty($encoding))
{
$this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$xleft, $_PosY+$ytop, $widthtouse, $heighttouse);
}
else
{
$pdf->SetXY($_PosX+$xleft, $_PosY+$ytop);
$pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L');
}
}
else if ($textleft!='' && $textright!='') // left and right part
{
if (($textleft == '%LOGO%' || $textleft == '%PHOTO%' || $textleft == '%BARCODE%') && !strstr($textright, '%') ) // left part logo/barcode right part text
{
if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+$xleft, $_PosY+$ytop, $widthtouse/2, 0);
else if ($code && !empty($encoding))
{
$this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$xleft, $_PosY+$ytop, $widthtouse/2, $heighttouse);
}
$pdf->SetXY($_PosX+($widthtouse/2), $_PosY+$ytop);
$pdf->MultiCell($widthtouse/2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R');
}
else if (($textright == '%LOGO%' || $textright == '%PHOTO%' || $textright == '%BARCODE%') && !strstr($textleft, '%')) // right part logo/barcode left part text
{
if ($textright == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+($widthtouse/2), $_PosY+$ytop, $widthtouse/2, 0);
else if ($code && !empty($encoding))
{
$this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+($widthtouse/2), $_PosY+$ytop, $widthtouse/2, $heighttouse);
}
$pdf->SetXY($_PosX+$xleft, $_PosY+$ytop);
$pdf->MultiCell($widthtouse/2, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L');
}
else if ($textleft == '%LOGO%') // left part logo right part text/barcode
{
if ($logo) $pdf->Image($logo, $_PosX+$xleft, $_PosY+$ytop, 0, $logoHeight);
if ($code && !empty($encoding))
{
$this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$xleft+$logoWidth+1, $_PosY+$ytop, $widthtouse-$logoWidth-1, $heighttouse);
} else {
$pdf->SetXY($_PosX+$xleft+$logoWidth+1, $_PosY+$ytop);
$pdf->MultiCell($widthtouse-$logoWidth1-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R');
}
}
else if ($textright == '%LOGO%') // right part logo left part text/barcode
{
if ($logo) $pdf->Image($logo, $_PosX+$xleft+$widthtouse-$logoWidth+1, $_PosY+$ytop, 0, $logoHeight);
if ($code && !empty($encoding))
{
$this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$xleft, $_PosY+$ytop, $widthtouse-$logoWidth-1, $heighttouse);
} else {
$pdf->SetXY($_PosX+$xleft, $_PosY+$ytop);
$pdf->MultiCell($widthtouse-$logoWidth-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L');
}
}
else // text on halft left and text on half right
{
$pdf->SetXY($_PosX+$xleft, $_PosY+$ytop);
$pdf->MultiCell(round($this->_Width/2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L');
$pdf->SetXY($_PosX+round($this->_Width/2), $_PosY+$ytop);
$pdf->MultiCell(round($this->_Width/2)-2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R');
}
}
else // Only a right part
{
// Output right area
if ($textright == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX+$this->_Width-$widthtouse-$xleft, $_PosY+$ytop, 0, $logoHeight);
else if ($code && !empty($encoding))
{
$this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX+$this->_Width-$widthtouse-$xleft, $_PosY+$ytop, $widthtouse, $heighttouse);
}
else
{
$pdf->SetXY($_PosX+$xleft, $_PosY+$ytop);
$pdf->MultiCell($this->_Width-$xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R');
}
}
// Bottom
if ($footer!='')
{
$pdf->SetXY($_PosX, $_PosY+$this->_Height-$this->_Line_Height-1);
$pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($footer),0,1,'C');
}
//print "$_PosY+$this->_Height-$this->_Line_Height-1<br>\n";
$this->_COUNTY++;
if ($this->_COUNTY == $this->_Y_Number) {
// Si on est en bas de page, on remonte le 'curseur' de position
$this->_COUNTX++;
$this->_COUNTY=0;
}
if ($this->_COUNTX == $this->_X_Number) {
// Si on est en bout de page, alors on repart sur une nouvelle page
$this->_COUNTX=0;
$this->_COUNTY=0;
}
}
/**
* Function to build PDF on disk, then output on HTTP strem.
*
* @param array $arrayofrecords Array of record informations (array('textleft'=>,'textheader'=>, ..., 'id'=>,'photo'=>)
* @param Translate $outputlangs Lang object for output language
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param string $outputdir Output directory for pdf file
* @return int 1=OK, 0=KO
*/
function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir='')
{
global $user,$conf,$langs,$mysoc,$_Avery_Labels;
$this->code=$srctemplatepath;
$this->Tformat = $_Avery_Labels[$this->code];
if (empty($this->Tformat)) { dol_print_error('','ErrorBadTypeForCard'.$this->code); exit; }
$this->type = 'pdf';
$this->format = $this->Tformat['paper-size'];
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("admin");
$title=$outputlangs->transnoentities('Labels');
$keywords=$title." ".$outputlangs->convToOutputCharset($mysoc->name);
$dir = (empty($outputdir)?$conf->adherent->dir_temp:$outputdir);
$filename='tmp_address_sheet.pdf';
$file = $dir."/".$filename;
if (! file_exists($dir))
{
if (dol_mkdir($dir) < 0)
{
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
return 0;
}
}
$pdf=pdf_getInstance($this->format,$this->Tformat['metric']);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
$pdf->SetTitle($title);
$pdf->SetSubject($title);
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($keywords);
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins(0,0);
$pdf->SetAutoPageBreak(false);
$this->_Metric_Doc = $this->Tformat['metric'];
// Permet de commencer l'impression de l'etiquette desiree dans le cas ou la page a deja servie
$posX=1;
$posY=1;
if ($posX > 0) $posX--; else $posX=0;
if ($posY > 0) $posY--; else $posY=0;
$this->_COUNTX = $posX;
$this->_COUNTY = $posY;
$this->_Set_Format($pdf, $this->Tformat);
$pdf->Open();
$pdf->AddPage();
// Add each record
foreach($arrayofrecords as $val)
{
// imprime le texte specifique sur la carte
$this->addSticker($pdf, $outputlangs, $val);
}
//$pdf->SetXY(10, 295);
//$pdf->Cell($this->_Width, $this->_Line_Height, 'XXX',0,1,'C');
// Output to file
$pdf->Output($file,'F');
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
// Output to http stream
clearstatcache();
$attachment=true;
if (! empty($conf->global->MAIN_DISABLE_FORCE_SAVEAS)) $attachment=false;
$type=dol_mimetype($filename);
//if ($encoding) header('Content-Encoding: '.$encoding);
if ($type) header('Content-Type: '.$type);
if ($attachment) header('Content-Disposition: attachment; filename="'.$filename.'"');
else header('Content-Disposition: inline; filename="'.$filename.'"');
// Ajout directives pour resoudre bug IE
header('Cache-Control: Public, must-revalidate');
header('Pragma: public');
readfile($file);
return 1;
}
}

View File

@ -67,9 +67,10 @@ class ModelePDFLabels
* @param string $modele Force le modele a utiliser ('' to not force)
* @param Translate $outputlangs Objet lang a utiliser pour traduction
* @param string $outputdir Output directory
* @param string $template pdf generenate document class to use default 'standardlabel'
* @return int <0 if KO, >0 if OK
*/
function members_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir='')
function members_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outputdir='', $template='standardlabel')
{
global $conf,$langs;
$langs->load("members");
@ -98,13 +99,12 @@ function members_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $
}
}
else $code=$modele;
$modele='standardlabel';
// If selected modele is a filename template (then $modele="modelname:filename")
$tmp=explode(':',$modele,2);
$tmp=explode(':',$template,2);
if (! empty($tmp[1]))
{
$modele=$tmp[0];
$template=$tmp[0];
$srctemplatepath=$tmp[1];
}
else $srctemplatepath=$code;
@ -117,14 +117,14 @@ function members_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $
{
foreach(array('doc','pdf') as $prefix)
{
$file = $prefix."_".$modele.".class.php";
$file = $prefix."_".$template.".class.php";
// On verifie l'emplacement du modele
$file=dol_buildpath($reldir."core/modules/printsheet/doc/".$file,0);
if (file_exists($file))
{
$filefound=1;
$classname=$prefix.'_'.$modele;
$classname=$prefix.'_'.$template;
break;
}
}

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -164,7 +165,7 @@ if ($action == 'update' && $user->rights->expensereport->creer)
$result = $object->update($user);
if ($result > 0)
{
header("Location: ".$_SEVER["PHP_SELF"]."?id=".$_POST['id']);
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['id']);
exit;
}
else
@ -217,7 +218,7 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user
$subject = $langs->trans("ExpenseReportWaitingForApproval");
// CONTENT
$link = $urlwithroot.'/expenserecord/card.php?id='.$object->id;
$link = $urlwithroot.'/expensereport/card.php?id='.$object->id;
$message = $langs->trans("ExpenseReportWaitingForApprovalMessage", $expediteur->getFullName($langs), get_date_range($object->date_debut,$object->date_fin,'',$langs), $link);
// Rebuild pdf
@ -244,7 +245,7 @@ if ($action == "confirm_save" && GETPOST("confirm") == "yes" && $id > 0 && $user
{
$mesg=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($emailFrom,2),$mailfile->getValidAddress($emailTo,2));
setEventMessage($mesg);
header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else
@ -349,7 +350,7 @@ if ($action == "confirm_save_from_refuse" && GETPOST("confirm") == "yes" && $id
// SEND
$result=$mailfile->sendfile();
if ($result):
Header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
endif;
@ -454,7 +455,7 @@ if ($action == "confirm_approve" && GETPOST("confirm") == "yes" && $id > 0 && $u
$result=$mailfile->sendfile();
if ($result):
setEventMessage($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo));
Header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
else:
setEventMessage($langs->trans("ErrorFailedToSendMail",$emailFrom,$emailTo),'errors');
@ -540,7 +541,7 @@ if ($action == "confirm_refuse" && GETPOST('confirm')=="yes" && $id > 0 && $user
if ($result)
{
setEventMessage($langs->trans("MailSuccessfulySent",$emailFrom,$emailTo));
Header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else
@ -624,7 +625,7 @@ if ($action == "confirm_cancel" && GETPOST('confirm')=="yes" && GETPOST('detail_
$result=$mailfile->sendfile();
if ($result)
{
header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else
@ -793,7 +794,7 @@ if ($action == "confirm_brouillonner" && GETPOST('confirm')=="yes" && $id > 0 &&
if ($result > 0)
{
header("Location: ".$_SEVER["PHP_SELF"]."?id=".$id);
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id);
exit;
}
else
@ -1324,27 +1325,27 @@ else
dol_fiche_head($head, 'card', $langs->trans("TripCard"), 0, 'trip');
if ($action == 'save'):
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save","","",1);
if ($ret == 'html') print '<br>';
endif;
if ($action == 'save_from_refuse'):
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("SaveTrip"),$langs->trans("ConfirmSaveTrip"),"confirm_save_from_refuse","","",1);
if ($ret == 'html') print '<br>';
endif;
if ($action == 'delete'):
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("DeleteTrip"),$langs->trans("ConfirmDeleteTrip"),"confirm_delete","","",1);
if ($ret == 'html') print '<br>';
endif;
if ($action == 'validate'):
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_approve","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("ValideTrip"),$langs->trans("ConfirmValideTrip"),"confirm_approve","","",1);
if ($ret == 'html') print '<br>';
endif;
if ($action == 'paid'):
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("PaidTrip"),$langs->trans("ConfirmPaidTrip"),"confirm_paid","","",1);
if ($ret == 'html') print '<br>';
endif;
@ -1356,20 +1357,20 @@ else
}
if ($action == 'brouillonner'):
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("BrouillonnerTrip"),$langs->trans("ConfirmBrouillonnerTrip"),"confirm_brouillonner","","",1);
if ($ret == 'html') print '<br>';
endif;
if ($action == 'refuse') // Deny
{
$array_input = array('text'=>$langs->trans("ConfirmRefuseTrip"), array('type'=>"text",'label'=>$langs->trans("Comment"),'name'=>"detail_refuse",'size'=>"50",'value'=>""));
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id,$langs->trans("Deny"),'',"confirm_refuse",$array_input,"yes",1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id,$langs->trans("Deny"),'',"confirm_refuse",$array_input,"yes",1);
if ($ret == 'html') print '<br>';
}
if ($action == 'delete_line')
{
$ret=$form->form_confirm($_SEVER["PHP_SELF"]."?id=".$id."&amp;rowid=".$_GET['rowid'],$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1);
$ret=$form->form_confirm($_SERVER["PHP_SELF"]."?id=".$id."&amp;rowid=".$_GET['rowid'],$langs->trans("DeleteLine"),$langs->trans("ConfirmDeleteLine"),"confirm_delete_line",'','yes',1);
if ($ret == 'html') print '<br>';
}
@ -1805,18 +1806,18 @@ if ($action != 'create' && $action != 'edit')
if ($object->fk_user_author == $user->id)
{
// Modifier
print '<a class="butAction" href="'.$_SEVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('ModifyInfoGen').'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
// Validate
if (count($object->lines) > 0 || count($object->lignes) > 0)
{
print '<a class="butAction" href="'.$_SEVER["PHP_SELF"].'?action=save&id='.$id.'">'.$langs->trans('ValidateAndSubmit').'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=save&id='.$id.'">'.$langs->trans('ValidateAndSubmit').'</a>';
}
if ($user->rights->expensereport->supprimer)
{
// Supprimer
print '<a class="butActionDelete" href="'.$_SEVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
print '<a class="butActionDelete" href="'.$_SERVER["PHP_SELF"].'?action=delete&id='.$id.'">'.$langs->trans('Delete').'</a>';
}
}
}
@ -1831,12 +1832,12 @@ if ($action != 'create' && $action != 'edit')
if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid)
{
// Modifier
print '<a class="butAction" href="'.$_SEVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('ModifyInfoGen').'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$id.'">'.$langs->trans('Modify').'</a>';
// Brouillonner (le statut refusée est identique à brouillon)
//print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=brouillonner&id='.$id.'">'.$langs->trans('BROUILLONNER').'</a>';
// Enregistrer depuis le statut "Refusée"
print '<a class="butAction" href="'.$_SEVER["PHP_SELF"].'?action=save_from_refuse&id='.$id.'">'.$langs->trans('ValidateAndSubmit').'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=save_from_refuse&id='.$id.'">'.$langs->trans('ValidateAndSubmit').'</a>';
if ($user->rights->expensereport->supprimer)
{

View File

@ -1693,10 +1693,10 @@ class ExpenseReportLine
* Retourne la liste deroulante des differents etats d'une note de frais.
* Les valeurs de la liste sont les id de la table c_expensereport_statuts
*
* @param int $selected etat pre-selectionne
* @param int $selected preselect status
* @param string $htmlname Name of HTML select
* @param int $useempty 1=Add empty line
* @return string HTML select with sattus
* @return string HTML select with status
*/
function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempty=1)
{

View File

@ -3,7 +3,7 @@
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -41,7 +41,9 @@ $result = restrictedArea($user, 'expensereport','','');
$search_ref = GETPOST('search_ref');
$search_user = GETPOST('search_user','int');
$search_status = GETPOST('search_status','int');
$search_amount_ht = GETPOST('search_amount_ht','alpha');
$search_amount_ttc = GETPOST('search_amount_ttc','alpha');
$search_status = (GETPOST('search_status','alpha')!=''?GETPOST('search_status','alpha'):GETPOST('statut','alpha'));
$month_start = GETPOST("month_start","int");
$year_start = GETPOST("year_start","int");
$month_end = GETPOST("month_end","int");
@ -51,6 +53,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
{
$search_ref="";
$search_user="";
$search_amount_ht="";
$search_amount_ttc="";
$search_status="";
$month_start="";
$year_start="";
@ -58,6 +62,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
$year_end="";
}
if ($search_status == '') $search_status=-1;
if ($search_user == '') $search_user=-1;
/*
* View
*/
@ -86,17 +93,16 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$sql = "SELECT d.rowid, d.ref, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
$sql = "SELECT d.rowid, d.ref, d.fk_user_author, d.total_ht, d.total_tva, d.total_ttc, d.fk_statut as status,";
$sql.= " d.date_debut, d.date_fin,";
$sql.= " u.rowid as id_user, u.firstname, u.lastname";
$sql.= " FROM ".MAIN_DB_PREFIX."expensereport as d";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."user as u ON d.fk_user_author = u.rowid";
$sql.= " WHERE d.entity = ".$conf->entity;
// Where
// Ref
if(!empty($search_ref)){
$sql.= " WHERE d.ref LIKE '%".$db->escape($search_ref)."%'";
}else{
$sql.= " WHERE 1 = 1";
$sql.= " AND d.ref LIKE '%".$db->escape($search_ref)."%'";
}
// Date Start
if ($month_start > 0)
@ -126,13 +132,26 @@ else if ($year_end > 0)
{
$sql.= " AND d.date_fin BETWEEN '".$db->idate(dol_get_first_day($year_end,1,false))."' AND '".$db->idate(dol_get_last_day($year_end,12,false))."'";
}
// User
if ($search_name)
// Amount
if ($search_amount_ht != '')
{
$sql .= natural_search('u.lastname', $search_name);
$sql.= natural_search('d.total_ht', $search_amount_ht, 1);
}
if ($search_amount_ttc != '')
{
$sql.= natural_search('d.total_ttc', $search_amount_ttc, 1);
}
// User
if ($search_user != '' && $search_user >= 0)
{
$sql.= " AND u.rowid = '".$db->escape($search_user)."'";
}
// Status
if($search_status != '') $sql.= " AND d.fk_statut = '".$search_status."'";
if ($search_status != '' && $search_status >= 0)
{
if (strstr($search_status, ',')) $sql.=" AND d.fk_statut IN (".$db->escape($search_status).")";
else $sql.=" AND d.fk_statut = ".$search_status;
}
// RESTRICT RIGHTS
if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous))
@ -150,11 +169,17 @@ $resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">'."\n";
$param="";
if ($search_ref) $param.="&search_ref=".$search_ref;
if ($search_user) $param.="&search_user=".$search_user;
if ($search_amount_ht) $param.="&search_amount_ht=".$search_amount_ht;
if ($search_amount_ttc) $param.="&search_amount_ttc=".$search_amount_ttc;
if ($search_status >= 0) $param.="&search_status=".$search_status;
print_barre_liste($langs->trans("ListTripsAndExpenses"), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'."\n";
print '<table class="noborder" width="100%">';
print "<tr class=\"liste_titre\">";
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"d.rowid","",$param,'',$sortfield,$sortorder);
@ -194,9 +219,13 @@ if ($resql)
print '<td class="liste_titre">&nbsp;</td>';
}
// Amount with no taxe
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_amount_ht" value="'.$search_amount_ht.'"></td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
// Amount with all taxes
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_amount_ttc" value="'.$search_amount_ttc.'"></td>';
// Status
print '<td class="liste_titre" align="right">';
@ -249,9 +278,9 @@ if ($resql)
print '<tr class="liste_total">';
print '<td colspan="4">'.$langs->trans("Total").'</td>';
print '<td style="text-align:right;">'.$total_total_ht.'</td>';
print '<td style="text-align:right;">'.$total_total_tva.'</td>';
print '<td style="text-align:right;">'.$total_total_ttc.'</td>';
print '<td style="text-align:right;">'.price($total_total_ht).'</td>';
print '<td style="text-align:right;">'.price($total_total_tva).'</td>';
print '<td style="text-align:right;">'.price($total_total_ttc).'</td>';
print '<td></td>';
print '<td></td>';
print '</tr>';

View File

@ -1,6 +1,13 @@
# Dolibarr language file - en_US - Accounting Expert
CHARSET=UTF-8
ACCOUNTING_EXPORT_SEPARATORCSV=Column separator for export file
ACCOUNTING_EXPORT_DATE=Date format for export file
ACCOUNTING_EXPORT_PIECE=Export the number of piece ?
ACCOUNTING_EXPORT_GLOBAL_ACCOUNT=Export with global account ?
ACCOUNTING_EXPORT_LABEL=Export the label ?
ACCOUNTING_EXPORT_AMOUNT=Export the amount ?
ACCOUNTING_EXPORT_DEVISE=Export the devise ?
Accounting=Accounting
Globalparameters=Global parameters
Chartofaccounts=Chart of accounts
@ -81,9 +88,8 @@ ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounts
ACCOUNTING_SELL_JOURNAL=Sell journal
ACCOUNTING_PURCHASE_JOURNAL=Purchase journal
ACCOUNTING_BANK_JOURNAL=Bank journal
ACCOUNTING_CASH_JOURNAL=Cash journal
ACCOUNTING_MISCELLANEOUS_JOURNAL=Miscellaneous journal
ACCOUNTING_EXPENSEREPORT_JOURNAL=Expense report journal
ACCOUNTING_SOCIAL_JOURNAL=Social journal
ACCOUNTING_ACCOUNT_TRANSFER_CASH=Account of transfer

View File

@ -1424,6 +1424,8 @@ BarcodeDescUPC=Barcode of type UPC
BarcodeDescISBN=Barcode of type ISBN
BarcodeDescC39=Barcode of type C39
BarcodeDescC128=Barcode of type C128
BarcodeDescDATAMATRIX=Barcode of type Datamatrix
BarcodeDescQRCODE=Barcode of type QR code
GenbarcodeLocation=Bar code generation command line tool (used by internal engine for some bar code types). Must be compatible with "genbarcode".<br>For example: /usr/local/bin/genbarcode
BarcodeInternalEngine=Internal engine
BarCodeNumberManager=Manager to auto define barcode numbers

View File

@ -131,7 +131,7 @@ ProductToAddSearch=Search product to add
AddDel=Add/Delete
Quantity=Quantity
NoMatchFound=No match found
ProductAssociationList=List of related products/services: name of product/service (quantity affected)
ProductAssociationList=List of products/services that are component of this virtual product/package
ProductParentList=List of package products/services with this product as a component
ErrorAssociationIsFatherOfThis=One of selected product is parent with current product
DeleteProduct=Delete a product/service

View File

@ -12,7 +12,6 @@ Notify_FICHINTER_VALIDATE=Validation fiche intervention
Notify_FICHINTER_SENTBYMAIL=Envoi fiche d'intervention par email
Notify_BILL_VALIDATE=Validation facture client
Notify_BILL_UNVALIDATE=Dévalidation facture client
Notify_ORDER_SUPPLIER_VALIDATE=Commande fournisseur enregistrée
Notify_ORDER_SUPPLIER_APPROVE=Approbation commande fournisseur
Notify_ORDER_SUPPLIER_REFUSE=Refus commande fournisseur
Notify_ORDER_VALIDATE=Validation commande client

View File

@ -58,6 +58,7 @@ $id=GETPOST('id', 'int');
$ref=GETPOST('ref', 'alpha');
$type=GETPOST('type','int');
$action=(GETPOST('action','alpha') ? GETPOST('action','alpha') : 'view');
$cancel=GETPOST('cancel');
$confirm=GETPOST('confirm','alpha');
$socid=GETPOST('socid','int');
if (! empty($user->societe_id)) $socid=$user->societe_id;
@ -98,6 +99,8 @@ $hookmanager->initHooks(array('productcard','globalcard'));
* Actions
*/
if ($cancel) $action = '';
$createbarcode=empty($conf->barcode->enabled)?0:1;
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->creer_advance)) $createbarcode=0;
@ -520,19 +523,45 @@ if (empty($reshook))
}
// Add product into proposal
if ($object->id > 0 && $action == 'addinpropal')
// Add product into object
if ($object->id > 0 && $action == 'addin')
{
$propal = new Propal($db);
$result=$propal->fetch(GETPOST('propalid'));
if ($result <= 0)
if (GETPOST('propalid') > 0)
{
dol_print_error($db,$propal->error);
exit;
$propal = new Propal($db);
$result=$propal->fetch(GETPOST('propalid'));
if ($result <= 0)
{
dol_print_error($db,$propal->error);
exit;
}
$thirpdartyid = $propal->socid;
}
elseif (GETPOST('commandeid') > 0)
{
$commande = new Commande($db);
$result=$commande->fetch(GETPOST('commandeid'));
if ($result <= 0)
{
dol_print_error($db,$commande->error);
exit;
}
$thirpdartyid = $commande->socid;
}
elseif (GETPOST('factureid') > 0)
{
$facture = new Facture($db);
$result=$facture->fetch(GETPOST('factureid'));
if ($result <= 0)
{
dol_print_error($db,$facture->error);
exit;
}
$thirpdartyid = $facture->socid;
}
$soc = new Societe($db);
$result=$soc->fetch($propal->socid);
$result=$soc->fetch($thirpdartyid);
if ($result <= 0)
{
dol_print_error($db,$soc->error);
@ -589,254 +618,116 @@ if (empty($reshook))
}
}
$result = $propal->addline(
$desc,
$pu_ht,
GETPOST('qty'),
$tva_tx,
$localtax1_tx, // localtax1
$localtax2_tx, // localtax2
$object->id,
GETPOST('remise_percent'),
$price_base_type,
$pu_ttc,
0,
0,
-1,
0,
0,
0,
0,
'',
'',
'',
0,
$object->fk_unit
);
if ($result > 0)
if (GETPOST('propalid') > 0)
{
header("Location: ".DOL_URL_ROOT."/comm/propal.php?id=".$propal->id);
return;
$result = $propal->addline(
$desc,
$pu_ht,
GETPOST('qty'),
$tva_tx,
$localtax1_tx, // localtax1
$localtax2_tx, // localtax2
$object->id,
GETPOST('remise_percent'),
$price_base_type,
$pu_ttc,
0,
0,
-1,
0,
0,
0,
0,
'',
'',
'',
0,
$object->fk_unit
);
if ($result > 0)
{
header("Location: ".DOL_URL_ROOT."/comm/propal.php?id=".$propal->id);
return;
}
setEventMessage($langs->trans("ErrorUnknown").": $result", 'errors');
}
setEventMessage($langs->trans("ErrorUnknown").": $result", 'errors');
}
// Add product into order
if ($object->id > 0 && $action == 'addincommande')
{
$commande = new Commande($db);
$result=$commande->fetch(GETPOST('commandeid'));
if ($result <= 0)
elseif (GETPOST('commandeid') > 0)
{
dol_print_error($db,$commande->error);
exit;
$result = $commande->addline(
$desc,
$pu_ht,
GETPOST('qty'),
$tva_tx,
$localtax1_tx, // localtax1
$localtax2_tx, // localtax2
$object->id,
GETPOST('remise_percent'),
'',
'',
$price_base_type,
$pu_ttc,
'',
'',
0,
-1,
0,
0,
null,
0,
'',
0,
$object->fk_unit
);
if ($result > 0)
{
header("Location: ".DOL_URL_ROOT."/commande/card.php?id=".$commande->id);
exit;
}
}
$soc = new Societe($db);
$result=$soc->fetch($commande->socid);
if ($result <= 0)
{
dol_print_error($db,$soc->error);
exit;
}
$desc = $object->description;
$tva_tx = get_default_tva($mysoc, $soc, $object->id);
$localtax1_tx= get_localtax($tva_tx, 1, $soc);
$localtax2_tx= get_localtax($tva_tx, 2, $soc);
$pu_ht = $object->price;
$pu_ttc = $object->price_ttc;
$price_base_type = $object->price_base_type;
// If multiprice
if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level)
{
$pu_ht = $object->multiprices[$soc->price_level];
$pu_ttc = $object->multiprices_ttc[$soc->price_level];
$price_base_type = $object->multiprices_base_type[$soc->price_level];
}
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
elseif (GETPOST('factureid') > 0)
{
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$result = $facture->addline(
$desc,
$pu_ht,
GETPOST('qty'),
$tva_tx,
$localtax1_tx,
$localtax2_tx,
$object->id,
GETPOST('remise_percent'),
'',
'',
'',
'',
'',
$price_base_type,
$pu_ttc,
Facture::TYPE_STANDARD,
-1,
0,
'',
0,
0,
null,
0,
'',
0,
100,
'',
$object->fk_unit
);
$prodcustprice = new Productcustomerprice($db);
$filter = array('t.fk_product' => $object->id,'t.fk_soc' => $soc->id);
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
if ($result) {
if (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines [0]->price);
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
$price_base_type = $prodcustprice->lines [0]->price_base_type;
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
}
}
if ($result > 0)
{
header("Location: ".DOL_URL_ROOT."/compta/facture.php?facid=".$facture->id);
exit;
}
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($tva_tx != $object->tva_tx)
{
if ($price_base_type != 'HT')
{
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU');
}
else
{
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
}
}
$result = $commande->addline(
$desc,
$pu_ht,
GETPOST('qty'),
$tva_tx,
$localtax1_tx, // localtax1
$localtax2_tx, // localtax2
$object->id,
GETPOST('remise_percent'),
'',
'',
$price_base_type,
$pu_ttc,
'',
'',
0,
-1,
0,
0,
null,
0,
'',
0,
$object->fk_unit
);
if ($result > 0)
{
header("Location: ".DOL_URL_ROOT."/commande/card.php?id=".$commande->id);
exit;
}
}
// Add product into invoice
if ($object->id > 0 && $action == 'addinfacture' && $user->rights->facture->creer)
{
$facture = New Facture($db);
$result=$facture->fetch(GETPOST('factureid'));
if ($result <= 0)
{
dol_print_error($db,$facture->error);
exit;
}
$soc = new Societe($db);
$soc->fetch($facture->socid);
if ($result <= 0)
{
dol_print_error($db,$soc->error);
exit;
}
$desc = $object->description;
$tva_tx = get_default_tva($mysoc, $soc, $object->id);
$localtax1_tx= get_localtax($tva_tx, 1, $soc);
$localtax2_tx= get_localtax($tva_tx, 2, $soc);
$pu_ht = $object->price;
$pu_ttc = $object->price_ttc;
$price_base_type = $object->price_base_type;
// If multiprice
if ($conf->global->PRODUIT_MULTIPRICES && $soc->price_level)
{
$pu_ht = $object->multiprices[$soc->price_level];
$pu_ttc = $object->multiprices_ttc[$soc->price_level];
$price_base_type = $object->multiprices_base_type[$soc->price_level];
}
elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES))
{
require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php';
$prodcustprice = new Productcustomerprice($db);
$filter = array('t.fk_product' => $object->id,'t.fk_soc' => $soc->id);
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
if ($result) {
if (count($prodcustprice->lines) > 0) {
$pu_ht = price($prodcustprice->lines [0]->price);
$pu_ttc = price($prodcustprice->lines [0]->price_ttc);
$price_base_type = $prodcustprice->lines [0]->price_base_type;
$prod->tva_tx = $prodcustprice->lines [0]->tva_tx;
}
}
}
// On reevalue prix selon taux tva car taux tva transaction peut etre different
// de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur).
if ($tva_tx != $object->tva_tx)
{
if ($price_base_type != 'HT')
{
$pu_ht = price2num($pu_ttc / (1 + ($tva_tx/100)), 'MU');
}
else
{
$pu_ttc = price2num($pu_ht * (1 + ($tva_tx/100)), 'MU');
}
}
$result = $facture->addline(
$desc,
$pu_ht,
GETPOST('qty'),
$tva_tx,
$localtax1_tx,
$localtax2_tx,
$object->id,
GETPOST('remise_percent'),
'',
'',
'',
'',
'',
$price_base_type,
$pu_ttc,
Facture::TYPE_STANDARD,
-1,
0,
'',
0,
0,
null,
0,
'',
0,
100,
'',
$object->fk_unit
);
if ($result > 0)
{
header("Location: ".DOL_URL_ROOT."/compta/facture.php?facid=".$facture->id);
exit;
}
}
}
if (GETPOST("cancel") == $langs->trans("Cancel"))
{
$action = '';
header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id);
exit;
}
/*
@ -1174,7 +1065,7 @@ else
$type = $langs->trans('Product');
if ($object->isservice()) $type = $langs->trans('Service');
print_fiche_titre($langs->trans('Modify').' '.$type.' : '.(is_object($object->oldcopy)?$object->oldcopy->ref:$object->ref), "");
//print_fiche_titre($langs->trans('Modify').' '.$type.' : '.(is_object($object->oldcopy)?$object->oldcopy->ref:$object->ref), "");
// Main official, simple, and not duplicated code
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'" method="POST">'."\n";
@ -1182,6 +1073,12 @@ else
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="id" value="'.$object->id.'">';
print '<input type="hidden" name="canvas" value="'.$object->canvas.'">';
$head=product_prepare_head($object);
$titre=$langs->trans("CardProduct".$object->type);
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
dol_fiche_head($head, 'card', $titre, 0, $picto);
print '<table class="border allwidth">';
// Ref
@ -1374,7 +1271,7 @@ else
foreach($cats as $cat) {
$arrayselected[] = $cat->id;
}
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, 250);
print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%');
print "</td></tr>";
// Units
@ -1409,10 +1306,10 @@ else
print '</td></tr>';
print '</table>';
print '<br>';
//}
dol_fiche_end();
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@ -1688,16 +1585,8 @@ else
print '<!-- End show Note --> '."\n";
// Categories
print '<tr><td valign="top">'.$langs->trans("Categories").'</td><td colspan="3">';
$cat = new Categorie($db);
$categories = $cat->containing($object->id,0);
$catarray = $form->select_all_categories(0, '', 'parent', 64, 0, 1);
$toprint = array();
foreach($categories as $c) {
$toprint[] = $catarray[$c->id];
}
print implode('<br>', $toprint);
print '<tr><td valign="middle">'.$langs->trans("Categories").'</td><td colspan="3">';
print $form->showCategories($object->id,'product');
print "</td></tr>";
print "</table>\n";
@ -1817,42 +1706,24 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status)
$langs->load("propal");
$html .= '<tr class="liste_titre">';
$html .= '<td class="liste_titre">'.$langs->trans("AddToDraftProposals").'</td>';
$html .= '</tr><tr>';
$html .= '<td valign="top">';
$var=true;
$otherprop = $propal->liste_array(2,1,0);
$html .= '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
$html .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$html .= '<table class="nobordernopadding" width="100%">';
if (is_array($otherprop) && count($otherprop))
{
$var=!$var;
$html .= '<tr '.$bc[$var].'><td style="width: 200px;">';
$html .= '<input type="hidden" name="action" value="addinpropal">';
$html .= $langs->trans("Proposals").'</td><td colspan="2">';
$html .= '<tr><td style="width: 200px;">';
$html .= $langs->trans("AddToDraftProposals").'</td><td colspan="2">';
$html .= $form->selectarray("propalid", $otherprop, 0, 1);
$html .= '</td></tr>';
$html .= '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
$html .= '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
$html .= '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
$html .= '</td><td align="right">';
$html .= '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
$html .= '</td></tr>';
}
else
{
$html .= "<tr ".$bc[!$var]."><td>";
{
$html .= '<tr><td style="width: 200px;">';
$html .= $langs->trans("AddToDraftProposals").'</td><td colspan="2">';
$html .= $langs->trans("NoDraftProposals");
$html .= '</td></tr>';
}
$html .= '</table>';
$html .= '</form>';
$html .= '</td>';
$html .= '</tr>';
}
// Commande
@ -1862,42 +1733,23 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status)
$langs->load("orders");
$html .= '<tr class="liste_titre">';
$html .= '<td class="liste_titre">'.$langs->trans("AddToDraftOrders").'</td>';
$html .= '</tr><tr>';
$html .= '<td valign="top">';
$var=true;
$othercom = $commande->liste_array(2, 1, null);
$html .= '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
$html .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$html .= '<table class="nobordernopadding" width="100%">';
if (is_array($othercom) && count($othercom))
{
$var=!$var;
$html .= '<tr '.$bc[$var].'><td style="width: 200px;">';
$html .= '<input type="hidden" name="action" value="addincommande">';
$html .= $langs->trans("Orders").'</td><td colspan="2">';
$html .= '<tr><td style="width: 200px;">';
$html .= $langs->trans("AddToDraftOrders").'</td><td colspan="2">';
$html .= $form->selectarray("commandeid", $othercom, 0, 1);
$html .= '</td></tr>';
$html .= '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
$html .= '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
$html .= '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
$html .= '</td><td align="right">';
$html .= '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
$html .= '</td></tr>';
}
else
{
$html .= "<tr ".$bc[!$var]."><td>";
$html .= '<tr><td style="width: 200px;">';
$html .= $langs->trans("AddToDraftOrders").'</td><td colspan="2">';
$html .= $langs->trans("NoDraftOrders");
$html .= '</td></tr>';
}
$html .= '</table>';
$html .= '</form>';
$html .= '</td>';
$html .= '</tr>';
}
// Factures
@ -1907,51 +1759,48 @@ if ($object->id && ($action == '' || $action == 'view') && $object->status)
$langs->load("bills");
$html .= '<tr class="liste_titre">';
$html .= '<td class="liste_titre">'.$langs->trans("AddToDraftInvoices").'</td>';
$html .= '</tr><tr>';
$html .= '<td valign="top">';
$var=true;
$otherinvoice = $invoice->liste_array(2, 1, null);
$html .= '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
$html .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
$html .= '<table class="nobordernopadding" width="100%">';
if (is_array($otherinvoice) && count($otherinvoice))
{
$var=!$var;
$html .= '<tr '.$bc[$var].'><td style="width: 200px;">';
$html .= '<input type="hidden" name="action" value="addinfacture">';
$html .= $langs->trans("Invoice").'</td><td colspan="2">';
$html .= '<tr><td style="width: 200px;">';
$html .= $langs->trans("AddToDraftInvoices").'</td><td colspan="2">';
$html .= $form->selectarray("factureid", $otherinvoice, 0, 1);
$html .= '</td></tr>';
$html .= '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Quantity").' ';
$html .= '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
$html .= '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
$html .= '</td><td align="right">';
$html .= '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
$html .= '</td></tr>';
}
else
{
$html .= "<tr ".$bc[!$var]."><td>";
$html .= '<tr><td style="width: 200px;">';
$html .= $langs->trans("AddToDraftInvoices").'</td><td colspan="2">';
$html .= $langs->trans("NoDraftInvoices");
$html .= '</td></tr>';
}
$html .= '</table>';
$html .= '</form>';
$html .= '</td>';
$html .= '</tr>';
}
//If any text is going to be printed, then we show the table
if (!empty($html))
{
print '<table width="100%" class="noborder">';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="addin">';
print load_fiche_titre($langs->trans("Add"),'','');
$html .= '<tr><td class="nowrap">'.$langs->trans("Quantity").' ';
$html .= '<input type="text" class="flat" name="qty" size="1" value="1"></td><td class="nowrap">'.$langs->trans("ReductionShort").'(%) ';
$html .= '<input type="text" class="flat" name="remise_percent" size="1" value="0">';
$html .= '</td></tr>';
print '<table width="100%" class="border">';
print $html;
print '</table>';
print '<br>';
print '<div class="center">';
print '<input type="submit" class="button" value="'.$langs->trans("Add").'">';
print '</div>';
print '</form>';
}
}

View File

@ -2815,16 +2815,16 @@ class Product extends CommonObject
/**
* Return all Father products fo current product
*
* @return array prod
* @return array Array of product
* @see getParent
*/
function getFather()
{
$sql = "SELECT p.label as label,p.rowid,pa.fk_product_pere as id,p.fk_product_type";
$sql = "SELECT p.rowid, p.label as label, p.ref as ref, pa.fk_product_pere as id, p.fk_product_type, pa.qty, pa.incdec";
$sql.= " FROM ".MAIN_DB_PREFIX."product_association as pa,";
$sql.= " ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE p.rowid = pa.fk_product_pere";
$sql.= " AND pa.fk_product_fils=".$this->id;
$sql.= " AND pa.fk_product_fils = ".$this->id;
$res = $this->db->query($sql);
if ($res)
@ -2832,8 +2832,11 @@ class Product extends CommonObject
$prods = array ();
while ($record = $this->db->fetch_array($res))
{
$prods[$record['id']]['id'] = $record['rowid'];
$prods[$record['id']]['label'] = $this->db->escape($record['label']);
$prods[$record['id']]['id'] = $record['rowid'];
$prods[$record['id']]['ref'] = $record['ref'];
$prods[$record['id']]['label'] = $record['label'];
$prods[$record['id']]['qty'] = $record['qty'];
$prods[$record['id']]['incdec'] = $record['incdec'];
$prods[$record['id']]['fk_product_type'] = $record['fk_product_type'];
}
return $prods;
@ -2854,7 +2857,7 @@ class Product extends CommonObject
*/
function getParent()
{
$sql = "SELECT p.label as label,p.rowid,pa.fk_product_pere as id,p.fk_product_type";
$sql = "SELECT p.rowid, p.label as label, p.ref as ref, pa.fk_product_pere as id, p.fk_product_type, pa.qty";
$sql.= " FROM ".MAIN_DB_PREFIX."product_association as pa,";
$sql.= " ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE p.rowid = pa.fk_product_pere";
@ -3409,7 +3412,7 @@ class Product extends CommonObject
function is_photo_available($sdir)
{
include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php';
global $conf;
$dir = $sdir;

View File

@ -255,37 +255,59 @@ if ($id > 0 || ! empty($ref))
// Number of parent virtual products
print $form->textwithpicto($langs->trans("ParentProductsNumber").': '.count($prodsfather), $langs->trans('IfZeroItIsNotUsedByVirtualProduct'));
//print $form->textwithpicto($langs->trans("ParentProductsNumber").': '.count($prodsfather), $langs->trans('IfZeroItIsNotUsedByVirtualProduct'));
if (count($prodsfather) > 0)
{
print $langs->trans("ProductParentList").'<br>';
print '<table class="nobordernopadding">';
foreach($prodsfather as $value)
//if (count($prodsfather) > 0)
//{
print_fiche_titre($langs->trans("ProductParentList"),'','').'<br>';
print '<table class="centpercent noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('ParentProduct').'</td>';
print '<td>'.$langs->trans('Label').'</td>';
print '<td>'.$langs->trans('Qty').'</td>';
print '</td>';
if (count($prodsfather) > 0)
{
$class='pair';
foreach($prodsfather as $value)
{
$idprod= $value["id"];
$productstatic->id=$idprod;// $value["id"];
$productstatic->type=$value["fk_product_type"];
$productstatic->ref=$value['ref'];
$productstatic->label=$value['label'];
$class=($class=='impair')?'pair':'impair';
print '<tr class="'.$class.'">';
print '<td>'.$productstatic->getNomUrl(1,'composition').'</td>';
print '<td>'.$productstatic->label.'</td>';
print '<td>'.$value['qty'].'</td>';
print '</tr>';
}
}
else
{
$idprod= $value["id"];
$productstatic->id=$idprod;// $value["id"];
$productstatic->type=$value["fk_product_type"];
$productstatic->ref=$value['label'];
print '<tr>';
print '<td>'.$productstatic->getNomUrl(1,'composition').'</td>';
print '<td colspan="3">'.$langs->trans("None").'</td>';
print '</tr>';
}
print '</table>';
}
//}
print '<br>'."\n";
// Number of subproducts
print $form->textwithpicto($langs->trans("AssociatedProductsNumber").': '.(empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)?$nbofsubproducts:$nbofsubsubproducts), $langs->trans('IfZeroItIsNotAVirtualProduct'));
//print $form->textwithpicto($langs->trans("AssociatedProductsNumber").': '.(empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)?$nbofsubproducts:$nbofsubsubproducts), $langs->trans('IfZeroItIsNotAVirtualProduct'));
// List of subproducts
if (count($prods_arbo) > 0)
{
//if (count($prods_arbo) > 0)
//{
$atleastonenotdefined=0;
print $langs->trans("ProductAssociationList").'<br>';
print_fiche_titre($langs->trans("ProductAssociationList"),'','').'<br>';
print '<form name="formComposedProduct" action="'.$_SERVER['PHP_SELF'].'" method="post">';
print '<input type="hidden" name="action" value="save_composed_product" />';
@ -302,6 +324,8 @@ if ($id > 0 || ! empty($ref))
print '<td align="center">'.$langs->trans('ComposedProductIncDecStock').'</td>';
print '</tr>'."\n";
$class='pair';
foreach($prods_arbo as $value)
{
$productstatic->id=$value['id'];
@ -409,7 +433,7 @@ if ($id > 0 || ! empty($ref))
}*/
print '</form>';
}
//}
// Form with product to add
if ((empty($action) || $action == 'view' || $action == 'edit' || $action == 'search' || $action == 're-edit') && ($user->rights->produit->creer || $user->rights->service->creer))

View File

@ -523,20 +523,20 @@ if ($id || $ref)
$param="&id=".$product->id;
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Suppliers"),$_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder);
print '<td class="liste_titre">'.$langs->trans("SupplierRef").'</td>';
print_liste_field_titre($langs->trans("SupplierRef"));
if (!empty($conf->global->FOURN_PRODUCT_AVAILABILITY)) print_liste_field_titre($langs->trans("Availability"),$_SERVER["PHP_SELF"],"pfp.fk_availability","",$param,"",$sortfield,$sortorder);
print_liste_field_titre($langs->trans("QtyMin"),$_SERVER["PHP_SELF"],"pfp.quantity","",$param,'align="right"',$sortfield,$sortorder);
print '<td class="liste_titre" align="right">'.$langs->trans("VATRate").'</td>';
print '<td class="liste_titre" align="right">'.$langs->trans("PriceQtyMinHT").'</td>';
print_liste_field_titre($langs->trans("VATRate"));
print_liste_field_titre($langs->trans("PriceQtyMinHT"));
print_liste_field_titre($langs->trans("UnitPriceHT"),$_SERVER["PHP_SELF"],"pfp.unitprice","",$param,'align="right"',$sortfield,$sortorder);
print '<td class="liste_titre" align="right">'.$langs->trans("DiscountQtyMin").'</td>';
print_liste_field_titre($langs->trans("DiscountQtyMin"));
print_liste_field_titre($langs->trans("NbDaysToDelivery"),$_SERVER["PHP_SELF"],"pfp.delivery_time_days","",$param,'align="right"',$sortfield,$sortorder);
// Charges ????
if ($conf->global->PRODUCT_CHARGES)
{
if (! empty($conf->margin->enabled)) print '<td align="right">'.$langs->trans("UnitCharges").'</td>';
if (! empty($conf->margin->enabled)) print_liste_field_titre($langs->trans("UnitCharges"));
}
print '<td class="liste_titre"></td>';
print_liste_field_titre('');
print "</tr>\n";
$product_fourn = new ProductFournisseur($db);

View File

@ -65,7 +65,7 @@ else
<h1>
This page is a sample of page using tables. It is designed to make test with<br>
- css (edit page to change to test another css)<br>
- css (add parameter &theme=newthem to test another theme or edit css of current theme)<br>
- jmobile (add parameter dol_use_jmobile=1&dol_optimize_smallscreen=1 to enable view with jmobile)<br>
- dataTables<br>
- tablednd<br>
@ -115,9 +115,13 @@ This page is a sample of page using tables. It is designed to make test with<br>
<br><hr><br>Example 1 : Standard table => Use this if you need the drag and drop for lines<br>
<br><hr><br>Example 1 : Standard table/thead/tbody/tr/th-td (no class pair/impair on td) => Use this if you need the drag and drop for lines<br>
<?php
include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
$productspecimen=new Product($db);
$productspecimen->initAsSpecimen();
$sortfield='aaa';
$sortorder='ASC';
$tasksarray=array(1,2,3); // To force having several lines
@ -130,14 +134,14 @@ if (! empty($conf->use_javascript_ajax)) include DOL_DOCUMENT_ROOT.'/core/tpl/aj
<?php print getTitleFieldOfList($langs->trans('title2'),0,$_SERVER["PHP_SELF"],'bbb','','','align="right"',$sortfield,$sortorder); ?>
<?php print getTitleFieldOfList($langs->trans('title3'),0,$_SERVER["PHP_SELF"],'ccc','','','align="center"',$sortfield,$sortorder); ?>
</tr>
<tr class="pair"><td class="pair">a1</td><td class="pair" align="right">b1</td><td class="tdlineupdown pair" align="left">c1</td></tr>
<tr class="impair"><td class="impair">a2</td><td class="impair" align="right">b2</td><td class="tdlineupdown impair" align="left">c2</td></tr>
<tr class="pair"><td><?php echo $productspecimen->getNomUrl(1); ?></td><td align="right">b1</td><td class="tdlineupdown" align="left">c1</td></tr>
<tr class="impair"><td>a2</td><td align="right">b2</td><td class="tdlineupdown" align="left">c2</td></tr>
</table>
<br>
<br><hr><br>Example 2 : Table using tags: table/thead/tbody/tr/td + dataTable => Use this for long result tables<br>
<br><hr><br>Example 2 : Table using tags: table/thead/tbody/tr/th-td + dataTable => Use this for long result tables<br>
@ -221,9 +225,11 @@ $('xxxth').replaceWith(
<table id="idtableexample2" class="centpercent">
<thead>
<tr class="liste_titre">
<th>snake</th>
<th><label><input type="checkbox" name="hidedetails" value="2"> A checkbox inside a cell</label></th>
<?php print getTitleFieldOfList($langs->trans('zzz'),1,$_SERVER["PHP_SELF"],'','','','align="center" class="tagtd"',$sortfield,$sortorder); ?>
<th>Column A</th>
<th><label><input type="checkbox" name="hidedetails" value="2"> A checkbox inside a title of Column B</label></th>
<?php
print getTitleFieldOfList($langs->trans('Column C'),1,$_SERVER["PHP_SELF"],'','','','align="center" class="tagtd"',$sortfield,$sortorder);
?>
</tr>
</thead>
<tbody>
@ -292,7 +298,7 @@ $('xxxth').replaceWith(
<br>
<br><hr><br>Example 3 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tagtr+div.tagtd => Use this, but AVOID IT if possible, for tables that need to have a different form for each line (drag and drop of lines does not work for this case, also height of title can't be forced to a minimum)<br><br>
<br><hr><br>Example 3 : Table using tags: div.tagtable+div.tagtr+div or div.tagtable+div.tagtr+div.tagtd => Use this for tables that need to have a different form for each line, but AVOID IT if possible (drag and drop of lines does not work for this case, also height of title can't be forced to a minimum)<br><br>
<?php
@ -302,23 +308,29 @@ $('xxxth').replaceWith(
?>
<div class="tagtable centpercent" id="tablelines">
<div class="tagtr liste_titre">
<div class="tagtd">line3<input type="hidden" name="cartitem" value="3"></div>
<div class="tagtd">dfsdf</div>
<div class="tagtd">ffdsfsd</div>
<div class="tagtd tdlineupdown">aaaa</div>
<div class="tagtd">Title A<input type="hidden" name="cartitem" value="3"></div>
<div class="tagtd">title B</div>
<div class="tagtd">title C</div>
<div class="tagtd">title D</div>
</div>
<div class="impair tagtr">
<div class="pair tagtr">
<div class="tagtd">line4<input type="hidden" name="cartitem" value="3"></div>
<div class="tagtd">dfsdf</div>
<div class="tagtd"><input name="count" value="4"></div>
<div class="tagtd tdlineupdown">bbbb</div>
</div>
<div class="pair tagtr">
<div class="impair tagtr">
<div class="tagtd">line5<input type="hidden" name="cartitemb" value="3"></div>
<div class="tagtd">dfsdf</div>
<div class="tagtd"><input name="countb" value="4"></div>
<div class="tagtd tdlineupdown">bbbb</div>
</div>
<div class="pair tagtr">
<div class="tagtd">line6<input type="hidden" name="cartitem" value="3"></div>
<div class="tagtd">jghjgh</div>
<div class="tagtd">5</div>
<div class="tagtd tdlineupdown">lll</div>
</div>
<!-- Using form into div make Firefox crazy (page loading does not end) -->
<!-- <form class="liste_titre" method="POST" action="1.php">
<div>line1<input type="hidden" name="cartitem" value="1"></div>

View File

@ -1294,12 +1294,14 @@ class Societe extends CommonObject
/**
* Delete a third party from database and all its dependencies (contacts, rib...)
*
* @param int $id Id of third party to delete
* @param int $id Id of third party to delete
* @param User $user User who ask to delete thirparty
* @param int $call_trigger 0=No, 1=yes
* @return int <0 if KO, 0 if nothing done, >0 if OK
*/
function delete($id)
function delete($id, $user='', $call_trigger=1)
{
global $user, $langs, $conf;
global $langs, $conf;
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
@ -1314,10 +1316,14 @@ class Societe extends CommonObject
{
$this->db->begin();
// Call trigger
$result=$this->call_trigger('COMPANY_DELETE',$user);
if ($result < 0) $error++;
// End call triggers
// User is mandatory for trigger call
if ($user && $call_trigger)
{
// Call trigger
$result=$this->call_trigger('COMPANY_DELETE',$user);
if ($result < 0) $error++;
// End call triggers
}
if (! $error)
{

View File

@ -169,7 +169,7 @@ if (empty($reshook))
if (!$errors) {
//We finally remove the old thirdparty
if ($soc_origin->delete($soc_origin->id) < 1) {
if ($soc_origin->delete($soc_origin->id, $user) < 1) {
$db->rollback();
$errors++;
}
@ -598,7 +598,7 @@ if (empty($reshook))
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer)
{
$object->fetch($socid);
$result = $object->delete($socid);
$result = $object->delete($socid, $user);
if ($result > 0)
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 264 B

View File

@ -172,26 +172,21 @@ $colorbacktabcard2=join(',',colorStringToArray($colorbacktabcard2));
$tmppart=explode(',',$colorbackhmenu1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
if ($tmpval <= 360) $colortextbackhmenu='FFF';
else $colortextbackhmenu='444';
else $colortextbackhmenu='222';
$tmppart=explode(',',$colorbackvmenu1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
if ($tmpval <= 360) { $colortextbackvmenu='FFF'; }
else { $colortextbackvmenu='444'; }
else { $colortextbackvmenu='222'; }
$tmppart=explode(',',$colorbacktitle1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
if ($tmpval <= 360) { $colortexttitle='FFF'; $colorshadowtitle='888'; }
else { $colortexttitle='444'; $colorshadowtitle='FFF'; }
else { $colortexttitle='222'; $colorshadowtitle='FFF'; }
$tmppart=explode(',',$colorbacktabcard1);
$tmpval=(! empty($tmppart[1]) ? $tmppart[1] : '')+(! empty($tmppart[2]) ? $tmppart[2] : '')+(! empty($tmppart[3]) ? $tmppart[3] : '');
if ($tmpval <= 340) { $colortextbacktab='FFF'; }
else { $colortextbacktab='111'; }
$usecss3=true;
if ($conf->browser->name == 'ie' && round($conf->browser->version,2) < 10) $usecss3=false;
elseif ($conf->browser->name == 'iceweasel') $usecss3=false;
elseif ($conf->browser->name == 'epiphany') $usecss3=false;
print '/*'."\n";
print 'colred='.$colred.' colgreen='.$colgreen.' colblue='.$colblue."\n";
print 'isred='.$isred.' isgreen='.$isgreen.' isblue='.$isblue."\n";
@ -201,7 +196,6 @@ print 'colorbacklineimpairhover='.$colorbacklineimpairhover."\n";
print 'colorbacklinepair1='.$colorbacklinepair1."\n";
print 'colorbacklinepair2='.$colorbacklinepair2."\n";
print 'colorbacklinepairhover='.$colorbacklinepairhover."\n";
print 'usecss3='.$usecss3."\n";
print 'dol_hide_topmenu='.$dol_hide_topmenu."\n";
print 'dol_hide_leftmenu='.$dol_hide_leftmenu."\n";
print 'dol_optimize_smallscreen='.$dol_optimize_smallscreen."\n";
@ -249,7 +243,7 @@ textarea.cke_source:focus
box-shadow: none;
}
input, input.flat, textarea, textarea.flat, form.flat select, select.flat {
input, input.flat, textarea, textarea.flat, form.flat select, select, select.flat, .dataTables_length label select {
font-size: <?php print $fontsize ?>px;
font-family: <?php print $fontlist ?>;
background: #FDFDFD;
@ -570,17 +564,12 @@ div#tmenu_tooltip {
padding-<?php echo $right; ?>: 100px;
background: <?php echo $colorbackvmenu; ?>;
box-shadow: 0 0 6px rgba(0, 0, 0, .4) !important;
<?php if ($usecss3) { ?>
background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(128,128,128,.3)) );
<?php } else { ?>
background-image: rgb(<?php echo $colorbackhmenu1; ?>);
border-bottom: 1px solid #CCC;
<?php } ?>
<?php } ?>
}
@ -642,17 +631,12 @@ ul.tmenu { /* t r b l */
ul.tmenu li {
background: rgb(<?php echo $colorbackhmenu1 ?>);
<?php if ($usecss3) { ?>
background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(0,0,0,.3)) );
<?php } else { ?>
background-image: rgb(<?php echo $colorbackhmenu1; ?>);
border-bottom: 1px solid #CCC;
<?php } ?>
}
li.tmenu, li.tmenusel {
<?php print $minwidthtmenu?'min-width: '.$minwidthtmenu.'px;':''; ?>
@ -1034,18 +1018,12 @@ div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks
padding-bottom: 3px;
margin: 1px 0px 8px 2px;
<?php if ($usecss3) { ?>
background-image: -o-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu2; ?>) 0px, rgb(<?php echo $colorbackvmenu1; ?>) 3px);
background-image: -moz-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu2; ?>) 0px, rgb(<?php echo $colorbackvmenu1; ?>) 3px);
background-image: -webkit-linear-gradient(right, rgb(<?php echo $colorbackvmenu2; ?>) 0px, rgb(<?php echo $colorbackvmenu1; ?>) 3px);
background-image: -ms-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu2; ?>) 0px, rgb(<?php echo $colorbackvmenu1; ?>) 3px);
background-image: linear-gradient(bottom, rgb(<?php echo $colorbackvmenu2; ?>) 0px, rgb(<?php echo $colorbackvmenu1; ?>) 3px);
<?php } else { ?>
background-position:top;
background-repeat:repeat-x;
<?php } ?>
border-left: 1px solid #AAA;
border-right: 1px solid #BBB;
border-bottom: 1px solid #BBB;
@ -1070,13 +1048,11 @@ div.blockvmenusearch
margin: 1px 0px 8px 2px;
background: #E3E6E8;
<?php if ($usecss3) { ?>
background-image: -o-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 90%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: -moz-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 90%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 90%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: -ms-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 90%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 90%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
<?php } ?>
border-left: 1px solid #AAA;
border-right: 1px solid #CCC;
@ -1153,13 +1129,12 @@ td.photo {
/* ============================================================================== */
.largebutton {
<?php if ($usecss3) { ?>
background-image: -o-linear-gradient(bottom, rgba(200,200,200,0.1) 0%, rgba(255,255,255,0.3) 120%) !important;
background-image: -moz-linear-gradient(bottom, rgba(200,200,200,0.1) 0%, rgba(255,255,255,0.3) 120%) !important;
background-image: -webkit-linear-gradient(bottom, rgba(200,200,200,0.1) 0%, rgba(255,255,255,0.3) 120%) !important;
background-image: -ms-linear-gradient(bottom, rgba(200,200,200,0.1) 0%, rgba(255,255,255,0.3) 120%) !important;
background-image: linear-gradient(bottom, rgba(200,200,200,0.1) 0%, rgba(255,255,255,0.3) 120%) !important;
<?php } ?>
background: #FFF;
background-repeat: repeat-x !important;
border: 1px solid #CCC !important;
@ -1409,23 +1384,14 @@ div.tabBar {
border-left: 1px solid #AAA;
border-top: 1px solid #BBB;
width: auto;
/*
<?php if ($usecss3) { ?>
background-image: -o-linear-gradient(bottom, rgba(<?php echo $colorbacktabcard1; ?>, 0.5) 25%, rgba(<?php echo $colorbacktabcard2; ?>, 0.5) 100%);
background-image: -moz-linear-gradient(bottom, rgba(<?php echo $colorbacktabcard1; ?>, 0.5) 25%, rgba(<?php echo $colorbacktabcard2; ?>, 0.5) 100%);
background-image: -webkit-linear-gradient(bottom, rgba(<?php echo $colorbacktabcard1; ?>, 0.5) 25%, rgba(<?php echo $colorbacktabcard2; ?>, 0.5) 100%);
background-image: -ms-linear-gradient(bottom, rgba(<?php echo $colorbacktabcard1; ?>, 0.5) 25%, rgba(<?php echo $colorbacktabcard2; ?>, 0.5) 100%);
background-image: linear-gradient(bottom, rgba(<?php echo $colorbacktabcard1; ?>, 0.5) 25%, rgba(<?php echo $colorbacktabcard2; ?>, 0.5) 100%);
<?php } else { ?>
background: rgb(<?php echo $colorbacktabcard1; ?>);
<?php } ?>
*/
background: rgb(<?php echo $colorbacktabcard1; ?>);
<?php if (empty($dol_optimize_smallscreen)) { ?>
<?php if (empty($dol_optimize_smallscreen)) { ?>
-moz-box-shadow: 3px 3px 4px #DDD;
-webkit-box-shadow: 3px 3px 4px #DDD;
box-shadow: 3px 3px 4px #DDD;
<?php } ?>
<?php } ?>
}
div.tabsAction {
@ -1460,28 +1426,6 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active {
-webkit-border-radius:6px 6px 0px 0px;
border-radius:6px 6px 0px 0px;
/*
-moz-box-shadow: 0 -1px 4px rgba(0,0,0,.1);
-webkit-box-shadow: 0 -1px 4px rgba(0,0,0,.1);
box-shadow: 0 -1px 4px rgba(0,0,0,.1);
*/
border-bottom: none;
/*
border-right: 1px solid #BBB;
border-left: 1px solid #BBB;
border-top: 1px solid #CCC;
*/
/*
<?php if ($usecss3) { ?>
background-image: -o-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 35%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: -moz-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 35%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 35%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: -ms-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 35%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 35%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
<?php } ?>
background-image: none !important;
*/
background: rgb(<?php echo $colorbackvmenu2; ?>);
border-right: 1px solid #BBB;
@ -1492,14 +1436,6 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active {
}
.tabactive {
/*
<?php if ($usecss3) { ?>
background: rgba(<?php echo $colorbacktabcard2; ?>, 0.5) url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nav-overlay3.png',1); ?>) 50% 0 repeat-x;
<?php } else { ?>
background: rgb(<?php echo $colorbacktabactive; ?>) url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nav-overlay3.png',1); ?>) 50% 0 repeat-x;
<?php } ?>
*/
/*background-image: none !important; */
color: #<?php echo $colortextbacktab; ?> !important;
background: rgb(<?php echo $colorbacktabcard1; ?>) !important;
-moz-box-shadow: 0 -1px 4px rgba(0,0,0,.1);
@ -1899,53 +1835,28 @@ table.liste td {
}
*/
.impair:hover, td.nohover {
<?php if ($colorbacklineimpairhover) { if ($usecss3) { ?>
background: rgb(<?php echo $colorbacklineimpairhover; ?>);
.odd:hover, .impair:hover, .even:hover, .pair:hover, .even:hover, .pair:hover, table.dataTable tr.even:hover, table.dataTable tr.odd:hover
{
<?php if ($colorbacklinepairhover) { if ($colorbacklinepairhover > 0) { ?>
background: rgb(<?php echo $colorbacklinepairhover; ?>) !important;
<?php } else { ?>
background: #fafafa;
background: rgba(0, 0, 0, 0.05) !important;
<?php } } ?>
border: 0px;
}
.impair, .nohover .impair:hover, tr.impair td.nohover {
<?php if ($usecss3) { ?>
background: linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -o-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -moz-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -ms-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
<?php } else { ?>
background: #eaeaea;
<?php } ?>
.odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover {
font-family: <?php print $fontlist ?>;
border: 0px;
margin-bottom: 1px;
color: #202020;
min-height: 18px; /* seems to not be used */
}
.pair:hover {
<?php if ($colorbacklinepairhover) { if ($usecss3) { ?>
background: rgb(<?php echo $colorbacklinepairhover; ?>);
<?php } else { ?>
background: #fafafa;
<?php } }?>
border: 0px;
}
.pair, .nohover .pair:hover, tr.pair td.nohover {
/*
<?php if ($usecss3) { ?>
background: linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: -o-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: -moz-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: -ms-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
<?php } else { ?>
background: #ffffff;
<?php } ?>
*/
}
.even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover {
font-family: <?php print $fontlist ?>;
border: 0px;
margin-bottom: 1px;
@ -1953,11 +1864,17 @@ table.liste td {
background-color: #f9f9f9;
}
tr.pair td, tr.impair td, form.impair div.tagtd, form.pair div.tagtd {
padding: 5px 2px;
table.dataTable tr.odd {
background-color: #f9f9f9 !important;
}
table.dataTable td {
padding: 5px 2px 5px 3px !important;
}
tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair div.tagtd, form.pair div.tagtd, div.impair div.tagtd, div.pair div.tagtd, div.liste_titre div.tagtd {
padding: 5px 2px 5px 3px;
border-bottom: 1px solid #ddd;
}
tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td {
tr.even td .nobordernopadding tr td, tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td, tr.odd td .nobordernopadding tr td {
border-bottom: 0px !important;
}
td.nobottom, td.nobottom {
@ -1977,14 +1894,14 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list
{
background: rgb(<?php echo $colorbacktitle1; ?>);
background-repeat: repeat-x;
<?php if ($usecss3) { ?>
background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
font-weight: bold;
<?php } ?>
color: #<?php echo $colortexttitle; ?>;
font-family: <?php print $fontlist ?>;
border-bottom: 1px solid #FDFFFF;
@ -2097,14 +2014,14 @@ tr.box_titre {
height: 26px;
background: rgb(<?php echo $colorbacktitle1; ?>);
background-repeat: repeat-x;
<?php if ($usecss3) { ?>
background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(0,0,0,.3)) );
<?php } ?>
color: #<?php echo $colortexttitle; ?>;
text-shadow: 1px 0px 1px #<?php echo $colorshadowtitle; ?>;
font-family: <?php print $fontlist ?>, sans-serif;
@ -2118,30 +2035,17 @@ tr.box_titre td.boxclose {
}
tr.box_impair {
<?php if ($usecss3) { ?>
background: -o-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -moz-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -ms-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
<?php } else { ?>
background: #eaeaea;
<?php } ?>
font-family: <?php print $fontlist ?>;
}
tr.box_pair {
/*<?php if ($usecss3) { ?>
background: -o-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: -moz-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: -ms-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
<?php } else { ?>
background: #ffffff;
<?php } ?>
*/
font-family: <?php print $fontlist ?>;
background-color: #f9f9f9;
@ -2997,11 +2901,13 @@ div.dolEventError h1, div.dolEventError h2 {
/* ============================================================================== */
/* Datatable */
/* ============================================================================== */
.sorting_asc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc.png',1); ?>') no-repeat center right; }
.sorting_desc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc.png',1); ?>') no-repeat center right; }
.sorting_asc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc_disabled',1); ?>') no-repeat center right; }
.sorting_desc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc_disabled',1); ?>') no-repeat center right; }
table.dataTable tr.odd td.sorting_1, table.dataTable tr.even td.sorting_1 {
background: none !important;
}
.sorting_asc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc.png',1); ?>') no-repeat center right !important; }
.sorting_desc { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc.png',1); ?>') no-repeat center right !important; }
.sorting_asc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_asc_disabled.png',1); ?>') no-repeat center right !important; }
.sorting_desc_disabled { background: url('<?php echo dol_buildpath('/theme/'.$theme.'/img/sort_desc_disabled.png',1); ?>') no-repeat center right !important; }
.paginate_disabled_previous:hover, .paginate_enabled_previous:hover, .paginate_disabled_next:hover, .paginate_enabled_next:hover
{
font-weight: normal;
@ -3054,11 +2960,23 @@ a span.select2-chosen
.select2-container .select2-choice {
background-image: none;
}
.select2-choices .select2-search-choice {
border: 1px solid #aaa !important;
}
.select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit
{
background: #FFFFFF;
}
.select2-container-multi.select2-container-disabled .select2-choices {
background-color: #FFFFFF;
background-image: none;
border: none;
cursor: default;
}
.select2-container-multi .select2-choices .select2-search-choice {
margin-top: 2px;
margin-bottom: 2px;
}
/* ============================================================================== */
/* JMobile */
@ -3183,14 +3101,14 @@ ul.ulmenu {
border: 1px solid #5f5f7a !important;
background: rgb(<?php echo $colorbacktitle1; ?>);
background-repeat: repeat-x;
<?php if ($usecss3) { ?>
background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
font-weight: bold;
<?php } ?>
color: #<?php echo $colortexttitle; ?> !important;
}
.alilevel0 {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1019 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 796 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -97,14 +97,14 @@ $colorbackvmenu1b=($colred+5).','.($colgreen+6).','.($colblue+7); // vmen
$colorbackvmenu2=($colred-15).','.($colgreen-15).','.($colblue-15);
$colorbacktitle1=($colred-5).','.($colgreen-5).','.($colblue-5); // title of array
$colorbacktitle2=($colred-15).','.($colgreen-15).','.($colblue-15);
$colorbacktabcard1=($colred+15).','.($colgreen+16).','.($colblue+17); // card
$colorbacktabcard1='255,255,255'; // card
$colorbacktabcard2=($colred-15).','.($colgreen-15).','.($colblue-15);
$colorbacktabactive=($colred-15).','.($colgreen-15).','.($colblue-15);
$colorbacklineimpair1=(244+round($isred/3)).','.(244+round($isgreen/3)).','.(244+round($isblue/3)); // line impair
$colorbacklineimpair2=(250+round($isred/3)).','.(250+round($isgreen/3)).','.(250+round($isblue/3)); // line impair
$colorbacklineimpairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); // line impair
$colorbacklinepair1='255,255,255'; // line pair
$colorbacklinepair2='255,255,255'; // line pair
$colorbacklineimpair1='255,255,255'; // line impair
$colorbacklineimpair2='255,255,255'; // line impair
$colorbacklineimpairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); // line impair
$colorbacklinepair1=(244+round($isred/3)).','.(244+round($isgreen/3)).','.(244+round($isblue/3)); // line pair
$colorbacklinepair2=(250+round($isred/3)).','.(250+round($isgreen/3)).','.(250+round($isblue/3)); // line pair
$colorbacklinepairhover=(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)).','.(230+round(($isred+$isgreen+$isblue)/9)); // line pair
$colorbackbody='#f0f0f0';
$colortext='40,40,40';
@ -115,9 +115,7 @@ $fontsizesmaller='11';
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
{
// 90A4AE, 607D8B, 455A64, 37474F
//$conf->global->THEME_ELDY_TOPMENU_BACK1=join(',',colorStringToArray('#37474f')); // topmenu #607D8B
$conf->global->THEME_ELDY_TOPMENU_BACK1=join(',',colorStringToArray('#37474F')); // topmenu #607D8B
//$conf->global->THEME_ELDY_TOPMENU_BACK1=join(',',colorStringToArray('000')); // topmenu #607D8B
$conf->global->THEME_ELDY_TOPMENU_BACK2='236,236,236';
$conf->global->THEME_ELDY_VERMENU_BACK1='255,255,255'; // vmenu
$conf->global->THEME_ELDY_VERMENU_BACK1b='230,232,232'; // vmenu (not menu)
@ -135,12 +133,6 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
$conf->global->THEME_ELDY_LINEIMPAIR2='255,255,255';
$conf->global->THEME_ELDY_LINEIMPAIRHOVER='238,246,252';
$conf->global->THEME_ELDY_TEXT='50,50,130';
if ($dol_use_jmobile)
{
$conf->global->THEME_ELDY_BACKTABCARD1='245,245,245'; // topmenu
$conf->global->THEME_ELDY_BACKTABCARD2='245,245,245';
$conf->global->THEME_ELDY_BACKTABACTIVE='245,245,245';
}
}
$colorbackhmenu1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$conf->global->THEME_ELDY_TOPMENU_BACK1) :(empty($user->conf->THEME_ELDY_TOPMENU_BACK1)?$colorbackhmenu1:$user->conf->THEME_ELDY_TOPMENU_BACK1);
@ -198,11 +190,6 @@ if ($tmpval <= 340) { $colortextbacktab='FFF'; }
else { $colortextbacktab='111'; }
$usecss3=true;
if ($conf->browser->name == 'ie' && round($conf->browser->version,2) < 10) $usecss3=false;
elseif ($conf->browser->name == 'iceweasel') $usecss3=false;
elseif ($conf->browser->name == 'epiphany') $usecss3=false;
print '/*'."\n";
print 'colred='.$colred.' colgreen='.$colgreen.' colblue='.$colblue."\n";
print 'isred='.$isred.' isgreen='.$isgreen.' isblue='.$isblue."\n";
@ -212,7 +199,6 @@ print 'colorbacklineimpairhover='.$colorbacklineimpairhover."\n";
print 'colorbacklinepair1='.$colorbacklinepair1."\n";
print 'colorbacklinepair2='.$colorbacklinepair2."\n";
print 'colorbacklinepairhover='.$colorbacklinepairhover."\n";
print 'usecss3='.$usecss3."\n";
print 'dol_hide_topmenu='.$dol_hide_topmenu."\n";
print 'dol_hide_leftmenu='.$dol_hide_leftmenu."\n";
print 'dol_optimize_smallscreen='.$dol_optimize_smallscreen."\n";
@ -260,7 +246,7 @@ textarea.cke_source:focus
box-shadow: none;
}
input, input.flat, textarea, textarea.flat, form.flat select, select.flat {
input, input.flat, textarea, textarea.flat, form.flat select select, select.flat, .dataTables_length label select {
font-size: <?php print $fontsize ?>px;
font-family: <?php print $fontlist ?>;
background: #FDFDFD;
@ -613,6 +599,11 @@ display : table;
margin : 0px auto;
}
#pictotitle {
margin-right: 8px;
margin-bottom: 4px;
}
/* ============================================================================== */
/* Menu top et 1ere ligne tableau */
@ -631,17 +622,12 @@ div#tmenu_tooltip {
/* padding-<?php echo $right; ?>: 100px; */
background: <?php echo $colorbackvmenu; ?>;
/*box-shadow: 0 0 6px rgba(0, 0, 0, .4) !important;*/
<?php if ($usecss3) { ?>
background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(128,128,128,.3) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(128,128,128,.3)) );
<?php } else { ?>
background-image: rgb(<?php echo $colorbackhmenu1; ?>);
border-bottom: 1px solid #CCC;
<?php } ?>
<?php } ?>
}
@ -702,19 +688,12 @@ ul.tmenu { /* t r b l */
ul.tmenu li {
background: rgb(<?php echo $colorbackhmenu1 ?>);
<?php if ($usecss3) { ?>
/*
background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(0,0,0,.3)) );
*/
<?php } else { ?>
background-image: rgb(<?php echo $colorbackhmenu1; ?>);
border-bottom: 1px solid #CCC;
<?php } ?>
}
li.tmenu, li.tmenusel {
<?php print $minwidthtmenu?'min-width: '.$minwidthtmenu.'px;':''; ?>
@ -1078,6 +1057,7 @@ div.vmenu, td.vmenu {
}
.menu_contenu { padding-top: 4px; padding-bottom: 3px;}
#menu_contenu_logo { padding-right: 4px; }
a.vmenu:link, a.vmenu:visited, a.vmenu:hover, a.vmenu:active { font-size:<?php print $fontsize ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: bold; }
font.vmenudisabled { font-size:<?php print $fontsize ?>px; font-family: <?php print $fontlist ?>; text-align: <?php print $left; ?>; font-weight: bold; color: #93a5aa; }
@ -1102,28 +1082,6 @@ div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks
padding-top: 3px;
padding-bottom: 3px;
margin: 1px 0px 8px 0px;
/*
<?php if ($usecss3) { ?>
background-image: -o-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu2; ?>) 0px, rgb(<?php echo $colorbackvmenu1; ?>) 3px);
background-image: -moz-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu2; ?>) 0px, rgb(<?php echo $colorbackvmenu1; ?>) 3px);
background-image: -webkit-linear-gradient(right, rgb(<?php echo $colorbackvmenu2; ?>) 0px, rgb(<?php echo $colorbackvmenu1; ?>) 3px);
background-image: -ms-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu2; ?>) 0px, rgb(<?php echo $colorbackvmenu1; ?>) 3px);
background-image: linear-gradient(bottom, rgb(<?php echo $colorbackvmenu2; ?>) 0px, rgb(<?php echo $colorbackvmenu1; ?>) 3px);
<?php } else { ?>
background-position:top;
background-repeat:repeat-x;
<?php } ?>
border-left: 1px solid #AAA;
border-right: 1px solid #BBB;
border-bottom: 1px solid #BBB;
border-top: 1px solid #BBB;
border-radius: 5px;
-moz-border-radius: 5px;
-moz-box-shadow: 3px 3px 4px #DDD;
-webkit-box-shadow: 3px 3px 4px #DDD;
box-shadow: 3px 3px 4px #DDD;*/
padding-bottom: 10px;
border-bottom: 1px solid #DDD;
@ -1140,26 +1098,6 @@ div.blockvmenusearch
padding-top: 3px;
padding-bottom: 3px;
margin: 1px 0px 8px 0px;
/*
background: #E3E6E8;
<?php if ($usecss3) { ?>
background-image: -o-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 90%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: -moz-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 90%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 90%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: -ms-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 90%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 90%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
<?php } ?>
border-left: 1px solid #AAA;
border-right: 1px solid #CCC;
border-bottom: 1px solid #CCC;
border-top: 1px solid #CCC;
border-radius: 5px;
-moz-border-radius: 5px;
-moz-box-shadow: 3px 3px 4px #DDD;
-webkit-box-shadow: 3px 3px 4px #DDD;
box-shadow: 3px 3px 4px #DDD;
*/
padding-bottom: 10px;
border-bottom: 1px solid #DDD;
@ -1229,13 +1167,12 @@ td.photo {
/* ============================================================================== */
.largebutton {
<?php if ($usecss3) { ?>
background-image: -o-linear-gradient(bottom, rgba(200,200,200,0.1) 0%, rgba(255,255,255,0.3) 120%) !important;
background-image: -moz-linear-gradient(bottom, rgba(200,200,200,0.1) 0%, rgba(255,255,255,0.3) 120%) !important;
background-image: -webkit-linear-gradient(bottom, rgba(200,200,200,0.1) 0%, rgba(255,255,255,0.3) 120%) !important;
background-image: -ms-linear-gradient(bottom, rgba(200,200,200,0.1) 0%, rgba(255,255,255,0.3) 120%) !important;
background-image: linear-gradient(bottom, rgba(200,200,200,0.1) 0%, rgba(255,255,255,0.3) 120%) !important;
<?php } ?>
background: #FFF;
background-repeat: repeat-x !important;
border: 1px solid #CCC !important;
@ -1485,23 +1422,14 @@ div.tabBar {
border-left: 1px solid #BBB;
border-top: 1px solid #CCC;
width: auto;
<?php if ($usecss3) { ?>
background: rgb(<?php echo $colorbacktabcard2; ?>);
/*
background-image: -o-linear-gradient(bottom, rgba(<?php echo $colorbacktabcard1; ?>, 0.5) 25%, rgba(<?php echo $colorbacktabcard2; ?>, 0.5) 100%);
background-image: -moz-linear-gradient(bottom, rgba(<?php echo $colorbacktabcard1; ?>, 0.5) 25%, rgba(<?php echo $colorbacktabcard2; ?>, 0.5) 100%);
background-image: -webkit-linear-gradient(bottom, rgba(<?php echo $colorbacktabcard1; ?>, 0.5) 25%, rgba(<?php echo $colorbacktabcard2; ?>, 0.5) 100%);
background-image: -ms-linear-gradient(bottom, rgba(<?php echo $colorbacktabcard1; ?>, 0.5) 25%, rgba(<?php echo $colorbacktabcard2; ?>, 0.5) 100%);
background-image: linear-gradient(bottom, rgba(<?php echo $colorbacktabcard1; ?>, 0.5) 25%, rgba(<?php echo $colorbacktabcard2; ?>, 0.5) 100%);
*/
<?php } else { ?>
background: rgb(<?php echo $colorbacktabcard1; ?>);
<?php } ?>
<?php if (empty($dol_optimize_smallscreen)) { ?>
<?php if (empty($dol_optimize_smallscreen)) { ?>
-moz-box-shadow: 3px 3px 4px #DDD;
-webkit-box-shadow: 3px 3px 4px #DDD;
box-shadow: 3px 3px 4px #DDD;
<?php } ?>
<?php } ?>
}
div.tabsAction {
@ -1547,16 +1475,6 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active {
border-top: 1px solid #D8D8D8;
*/
/*
<?php if ($usecss3) { ?>
background: rgb(<?php echo $colorbacktabcard1; ?>);
/*background-image: -o-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 35%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: -moz-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 35%, rgb(<?php echo $colorback2; ?>) 100%);
background-image: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 35%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: -ms-linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 35%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);
background-image: linear-gradient(bottom, rgb(<?php echo $colorbackvmenu1; ?>) 35%, rgb(<?php echo $colorbackvmenu2; ?>) 100%);*/
<?php } ?>
*/
background-image: none !important;
}
@ -1573,14 +1491,7 @@ a.tab:link, a.tab:visited, a.tab:hover, a.tab#active {
-webkit-box-shadow: 0 -1px 4px rgba(0,0,0,.1);
box-shadow: 0 -1px 4px rgba(0,0,0,.1);
<?php if ($usecss3) { ?>
background: rgb(<?php echo $colorbacktabcard2; ?>) !important;
/* border-bottom: 1px solid rgb(<?php echo $colorbacktabactive; ?>) !important;
background: rgba(<?php echo $colorbacktabcard2; ?>, 0.5) url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nav-overlay3.png',1); ?>) 50% 0 repeat-x; */
<?php } else { ?>
background: rgb(<?php echo $colorbacktabactive; ?>) url(<?php echo dol_buildpath($path.'/theme/'.$theme.'/img/nav-overlay3.png',1); ?>) 50% 0 repeat-x;
<?php } ?>
/*background-image: none !important; */
color: #<?php echo $colortextbacktab; ?>;
}
a.tab:hover
@ -1789,6 +1700,10 @@ End bootstrap */
margin: 0px !important;
padding: 0px !important;
}
tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd
{
border: 0px;
}
.notopnoleft {
border-collapse: collapse;
@ -1816,6 +1731,13 @@ table.border, table.dataTable, .table-border, .table-border-col, .table-key-bord
padding: 1px 2px 1px 3px; /* t r b l */
}
.border tbody tr, .border tbody tr td {
height: 20px;
}
div.tabBar table.border tr {
height: 20px;
}
table.border td, div.border div div.tagtd {
padding: 2px 2px 2px 2px;
border: 1px solid #D0D0D0;
@ -1849,11 +1771,6 @@ table.noborder, table.formdoc, div.noborder {
border-right-color: #CCC;
border-right-style: solid;
/*
border-bottom-width: 1px;
border-bottom-color: #BBBBBB;
border-bottom-style: solid;
*/
border-left-width: 1px;
border-left-color: #CCC;
border-left-style: solid;
@ -1892,11 +1809,21 @@ table.nobordernopadding {
}
table.nobordernopadding tr {
border: 0px !important;
padding: 0px 0px;
padding: 0px 0px !important;
}
table.nobordernopadding td {
border: 0px !important;
padding: 0px 0px;
table.nobordernopadding tr td {
border: 0px;
padding: 0 3px 0 0 !important;
}
table.border tr td table.nobordernopadding tr td {
padding-top: 0px;
padding-bottom: 0px;
}
td.borderright {
border: none; /* to erase value for table.nobordernopadding td */
border-right-width: 1px !important;
border-right-color: #BBB !important;
border-right-style: solid !important;
}
/* For lists */
@ -1963,62 +1890,47 @@ table.liste td {
*/
.impair:hover, td.nohover {
<?php if ($colorbacklineimpairhover) { if ($usecss3) { ?>
<?php if ($colorbacklineimpairhover) { if ($colorbacklinepairhover > 0) { ?>
background: rgb(<?php echo $colorbacklineimpairhover; ?>);
<?php } else { ?>
background: #fafafa;
background: rgba(0, 0, 0, 0.05) !important;
<?php } } ?>
border: 0px;
}
.impair, .nohover .impair:hover, tr.impair td.nohover {
<?php if ($usecss3) { ?>
background: linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%) !important;
background: -o-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%) !important;
background: -moz-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%) !important;
background: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%) !important;
background: -ms-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%) !important;
<?php } else { ?>
background: #eaeaea;
<?php } ?>
.odd, .impair, .nohover .odd:hover, .nohover .impair:hover, tr.odd td.nohover, tr.impair td.nohover {
font-family: <?php print $fontlist ?>;
border: 0px;
margin-bottom: 1px;
color: #202020;
min-height: 18px; /* seems to not be used */
}
.pair:hover {
<?php if ($colorbacklinepairhover) { if ($usecss3) { ?>
background: rgb(<?php echo $colorbacklinepairhover; ?>);
<?php } else { ?>
background: #fafafa;
<?php } }?>
border: 0px;
}
.pair, .nohover .pair:hover, tr.pair td.nohover {
/*
<?php if ($usecss3) { ?>
background: linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%) !important;
background: -o-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%) !important;
background: -moz-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%) !important;
background: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%) !important;
background: -ms-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%) !important;
<?php } else { ?>
background: #ffffff;
<?php } ?>
*/
}
.even, .pair, .nohover .even:hover, .nohover .pair:hover, tr.even td.nohover, tr.pair td.nohover {
font-family: <?php print $fontlist ?>;
border: 0px;
margin-bottom: 1px;
color: #202020;
background-color: #f9f9f9;
}
tr.pair td, tr.impair td {
padding: 4px;
table.dataTable tr.odd {
background-color: #f9f9f9 !important;
}
table.dataTable td {
padding: 5px 2px 5px 3px !important;
}
tr.even td, tr.pair td, tr.odd td, tr.impair td, form.odd div.tagtd, form.impair div.tagtd, form.pair div.tagtd, div.impair div.tagtd, div.pair div.tagtd, div.liste_titre div.tagtd {
padding: 5px 2px 5px 3px;
border-bottom: 1px solid #ddd;
}
tr.even td .nobordernopadding tr td, tr.pair td .nobordernopadding tr td, tr.impair td .nobordernopadding tr td, tr.odd td .nobordernopadding tr td {
border-bottom: 0px !important;
}
td.nobottom, td.nobottom {
border-bottom: 0px !important;
}
div.liste_titre .tagtd {
vertical-align: middle;
}
@ -2033,26 +1945,27 @@ div.liste_titre, tr.liste_titre, tr.liste_titre_sel, form.liste_titre, form.list
{
background: rgb(<?php echo $colorbacktitle1; ?>);
background-repeat: repeat-x;
<?php if ($usecss3) { ?>
/*
background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
*/
font-weight: bold;
<?php } ?>
color: #<?php echo $colortexttitle; ?>;
font-family: <?php print $fontlist ?>;
border-bottom: 1px solid #FDFFFF;
text-align: <?php echo $left; ?>;
}
tr.liste_titre th, th.liste_titre, form.liste_titre div, div.liste_titre
{
border-bottom: 1px solid #FDFFFF;
}
tr.liste_titre th, th.liste_titre, tr.liste_titre td, td.liste_titre, form.liste_titre div, div.liste_titre
{
font-family: <?php print $fontlist ?>;
font-weight: bold;
border-bottom: 1px solid #FDFFFF;
text-shadow: 1px 0px 1px #<?php echo $colorshadowtitle; ?>;
vertical-align: middle;
}
@ -2092,7 +2005,11 @@ input.liste_titre {
.tableforservicepart1 .impair, .tableforservicepart1 .pair, .tableforservicepart2 .impair, .tableforservicepart2 .pair {
background: none;
//background: none;
background: #FFF;
}
.tableforservicepart1 tbody tr td, .tableforservicepart2 tbody tr td {
border-bottom: none;
}
.margintable td {
@ -2117,18 +2034,6 @@ div.tabBar .noborder {
* Boxes
*/
.tdboxstats {
<?php if ($usecss3) { ?>
background: -o-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 120%) !important;
background: -moz-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 120%) !important;
background: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 120%) !important;
background: -ms-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 120%) !important;
background: linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 120%) !important;
<?php } else { ?>
background: #ffffff !important;
<?php } ?>
}
.boxstats {
<?php print "float: ".$left.";\n"; ?>
margin: 3px;
@ -2160,16 +2065,6 @@ tr.box_titre {
height: 26px !important;
background: rgb(<?php echo $colorbacktitle1; ?>);
background-repeat: repeat-x;
<?php if ($usecss3) { ?>
/*
background-image: linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -o-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -moz-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -webkit-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -ms-linear-gradient(top, rgba(255,255,255,.3) 0%, rgba(0,0,0,.3) 100%);
background-image: -webkit-gradient( linear, left top, left bottom, color-stop(0, rgba(255,255,255,.3)), color-stop(1, rgba(0,0,0,.3)) );
*/
<?php } ?>
color: #<?php echo $colortexttitle; ?>;
text-shadow: 1px 0px 1px #<?php echo $colorshadowtitle; ?>;
font-family: <?php print $fontlist ?>, sans-serif;
@ -2183,28 +2078,21 @@ tr.box_titre td.boxclose {
}
tr.box_impair {
<?php if ($usecss3) { ?>
background: -o-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -moz-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: -ms-linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
background: linear-gradient(bottom, rgb(<?php echo $colorbacklineimpair1; ?>) 85%, rgb(<?php echo $colorbacklineimpair2; ?>) 100%);
<?php } else { ?>
background: #eaeaea;
<?php } ?>
font-family: <?php print $fontlist ?>;
}
tr.box_pair {
<?php if ($usecss3) { ?>
background: -o-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: -moz-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: -webkit-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: -ms-linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
background: linear-gradient(bottom, rgb(<?php echo $colorbacklinepair1; ?>) 85%, rgb(<?php echo $colorbacklinepair2; ?>) 100%);
<?php } else { ?>
background: #ffffff;
<?php } ?>
font-family: <?php print $fontlist ?>;
background-color: #f9f9f9;
@ -2581,6 +2469,8 @@ table.cal_event { border: none; border-collapse: collapse; margin-bottom: 1px
min-height: 20px;
}
table.cal_event td { border: none; padding-<?php print $left; ?>: 2px; padding-<?php print $right; ?>: 2px; padding-top: 0px; padding-bottom: 0px; }
table.cal_event td.cal_event { padding: 4px 4px !important; }
table.cal_event td.cal_event_right { padding: 4px 4px !important; }
ul.cal_event { padding-right: 2px; padding-top: 1px; border: none; list-style-type: none; margin: 0 auto; padding-left: 0px; padding-start: 0px; -khtml-padding-start: 0px; -o-padding-start: 0px; -moz-padding-start: 0px; -webkit-padding-start: 0px; }
li.cal_event { border: none; list-style-type: none; }
.cal_event a:link { color: #111111; font-size: 11px; font-weight: normal !important; }
@ -3115,10 +3005,23 @@ a span.select2-chosen
.select2-container .select2-choice {
background-image: none;
}
.select2-choices .select2-search-choice {
border: 1px solid #aaa !important;
}
.select2-results .select2-no-results, .select2-results .select2-searching, .select2-results .select2-ajax-error, .select2-results .select2-selection-limit
{
background: #FFFFFF;
}
.select2-container-multi.select2-container-disabled .select2-choices {
background-color: #FFFFFF;
background-image: none;
border: none;
cursor: default;
}
.select2-container-multi .select2-choices .select2-search-choice {
margin-top: 2px;
margin-bottom: 2px;
}
/* ============================================================================== */
@ -3244,14 +3147,14 @@ ul.ulmenu {
border: 1px solid #5f5f7a !important;
background: rgb(<?php echo $colorbacktitle1; ?>);
background-repeat: repeat-x;
<?php if ($usecss3) { ?>
background-image: -o-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -moz-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -webkit-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: -ms-linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
background-image: linear-gradient(bottom, rgba(0,0,0,0.3) 0%, rgba(250,250,250,0.3) 100%);
font-weight: bold;
<?php } ?>
color: #<?php echo $colortexttitle; ?> !important;
}
.alilevel0 {

View File

@ -121,7 +121,7 @@ $thirdparty_fields= array(
'vat_used' => array('name'=>'vat_used','type'=>'xsd:string'),
'vat_number' => array('name'=>'vat_number','type'=>'xsd:string'));
//Retreive all extrafield for thirdsparty
// Retrieve all extrafields for thirdsparty
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('societe',true);
@ -329,7 +329,7 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='')
'note_private' => $thirdparty->note_private,
'note_public' => $thirdparty->note_public);
//Retreive all extrafield for thirdsparty
// Retrieve all extrafields for thirdsparty
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('societe',true);
@ -445,7 +445,7 @@ function createThirdParty($authentication,$thirdparty)
$newobject->canvas=$thirdparty['canvas'];
$newobject->particulier=$thirdparty['individual'];
//Retreive all extrafield for thirdsparty
// Retrieve all extrafields for thirdsparty
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('societe',true);
@ -576,7 +576,7 @@ function updateThirdParty($authentication,$thirdparty)
$object->canvas=$thirdparty['canvas'];
//Retreive all extrafield for thirdsparty
// Retrieve all extrafields for thirdsparty
// fetch optionals attributes and labels
$extrafields=new ExtraFields($db);
$extralabels=$extrafields->fetch_name_optionals_label('societe',true);

View File

@ -416,7 +416,7 @@ class AdherentTest extends PHPUnit_Framework_TestCase
$this->assertNull($localobject->fk_soc);
//Now we remove the third party
$result = $thirdparty->delete($thirdparty->id);
$result = $thirdparty->delete($thirdparty->id,$user);
$this->assertEquals($result, 1);
return $localobject;

View File

@ -365,7 +365,7 @@ class SocieteTest extends PHPUnit_Framework_TestCase
$localobject=new Societe($this->savdb);
$result=$localobject->fetch($id);
$result=$localobject->delete($id);
$result=$localobject->delete($id, $user);
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertLessThan($result, 0);