diff --git a/ChangeLog b/ChangeLog index 4bfb6e73595..63c19ea52e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,7 @@ For users: - New: Add graph stats for suppliers orders in tab "stats" on products. - New: Add option MAIN_HIDE_INACTIVETAB_ON_PRINT to hide inactive tabs when you use the "print" view on screen. +- New: Add menu entry to barcode genration page. For translators: - Update language files. diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index bb4b434742d..083d05ae3ef 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -250,9 +250,12 @@ if ($id > 0) // Country print ''.$langs->trans("Country").''; - $img=picto_from_langcode($object->country_code); - if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); - else print ($img?$img.' ':'').$object->country; + if (! empty($object->country_code)) + { + $img=picto_from_langcode($object->country_code); + if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); + else print ($img?$img.' ':'').$object->country; + } print ''; // EMail diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index aa53d92d6c6..3434452c91d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -593,9 +593,11 @@ abstract class CommonObject /** - * Load data for barcode + * Load data for barcode into properties ->barcode_type* + * Properties ->barcode_type is used to find others. + * If not defined, ->element must be defined to know default barcode type. * - * @return int <0 if KO, >=0 if OK + * @return int <0 if KO, >=0 if OK */ function fetch_barcode() { @@ -2094,7 +2096,7 @@ abstract class CommonObject } $this->db->free($resql); - + if ($numrows) return $numrows; else return 0; } @@ -2150,7 +2152,7 @@ abstract class CommonObject $error=0; if (! empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return 0; // For avoid conflicts if trigger used - + if (! empty($this->array_options)) { // Check parameters diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 0ade2ab1b2b..070019a50de 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -569,7 +569,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; print ''; - $colspan=8; + $colspan=9; print ''; print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Poste"),$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder); @@ -583,17 +583,16 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''.$langs->trans("Skype").''; } print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder); + // Copy to clipboard print " "; + // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $colspan++; print ' '; } - if ($user->rights->societe->contact->creer) - { - $colspan++; - print ' '; - } + // Edit + print ' '; print ""; @@ -615,18 +614,23 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $colspan++; print ' '; } + + // Status print ''; print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status); print ''; + // Copy to clipboard print " "; + + // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { $colspan++; print ' '; } - + // Edit print ''; print ''; print ''; @@ -689,9 +693,10 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print ''; } + // Status print ''.$contactstatic->getLibStatut(5).''; - // copy in clipboard + // Copy to clipboard $coords = ''; if (!empty($object->name)) $coords .= addslashes($object->name)."
"; @@ -722,10 +727,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') if (!empty($object->country)) $coords .= "
".addslashes($object->country); } + print ''; print img_picto($langs->trans("Address"), 'object_address.png'); print ''; + // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { print ''; @@ -739,8 +746,8 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print img_object($langs->trans("Event"),"action"); print ''; } - - + + // Edit if ($user->rights->societe->contact->creer) { print ''; @@ -748,7 +755,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print img_edit(); print ''; } - + else print ' '; print "\n"; $i++; diff --git a/htdocs/core/lib/format_cards.lib.php b/htdocs/core/lib/format_cards.lib.php index 13708771e30..5f18cb1a976 100644 --- a/htdocs/core/lib/format_cards.lib.php +++ b/htdocs/core/lib/format_cards.lib.php @@ -77,7 +77,7 @@ $_Avery_Labels = array ( 'width'=>101.6, 'height'=>50.8, 'font-size'=>8), - '5164'=>array('name'=>'5164 (Letter)', + /* Bugged '5164'=>array('name'=>'5164 (Letter)', 'paper-size'=>'letter', 'metric'=>'in', 'marginLeft'=>0.148, @@ -88,7 +88,7 @@ $_Avery_Labels = array ( 'SpaceY'=>0, 'width'=>4.0, 'height'=>3.33, - 'font-size'=>12), + 'font-size'=>12), */ '8600'=>array('name'=>'8600 (Letter)', 'paper-size'=>'letter', 'metric'=>'mm', diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index dc40127818e..f4d3b80ee8c 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -18,7 +18,14 @@ * or see http://www.gnu.org/ */ -function payment_prepare_head($object) { +/** + * Returns an array with the tabs for the "Payment" section + * It loads tabs from modules looking for the entity payment + * + * @param Paiement $object Current payment object + * @return array Tabs for the payment section + */ +function payment_prepare_head(Paiement $object) { global $langs, $conf; @@ -46,7 +53,14 @@ function payment_prepare_head($object) { return $head; } -function payment_supplier_prepare_head($object) { +/** + * Returns an array with the tabs for the "Supplier payment" section + * It loads tabs from modules looking for the entity payment_supplier + * + * @param Paiement $object Current payment object + * @return array Tabs for the payment section + */ +function payment_supplier_prepare_head(Paiement $object) { global $langs, $conf; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 230287420b5..954cdc1c2d1 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -613,11 +613,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("suppliers"); $newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); - - if (empty($user->societe_id)) - { - $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire); - } + $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire); //$newmenu->add("/fourn/liste.php?leftmenu=suppliers", $langs->trans("List"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire); //$newmenu->add("/contact/list.php?leftmenu=suppliers&type=f",$langs->trans("Contacts"), 2, $user->rights->societe->lire && $user->rights->fournisseur->lire && $user->rights->societe->contact->lire); } @@ -640,25 +636,16 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { // Categories prospects/customers $newmenu->add("/categories/index.php?leftmenu=cat&type=2", $langs->trans("CustomersProspectsCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=2", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } // Categories Contact $newmenu->add("/categories/index.php?leftmenu=cat&type=4", $langs->trans("ContactCategoriesShort"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=4", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=4", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); // Categories suppliers if (! empty($conf->fournisseur->enabled)) { $newmenu->add("/categories/index.php?leftmenu=cat&type=1", $langs->trans("SuppliersCategoriesShort"), 0, $user->rights->categorie->lire); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); } //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } @@ -752,10 +739,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("bills"); $newmenu->add("/compta/facture/list.php?leftmenu=customers_bills",$langs->trans("BillsCustomers"),0,$user->rights->facture->lire, '', $mainmenu, 'customers_bills'); - if (empty($user->societe_id)) - { - $newmenu->add("/compta/facture.php?action=create&leftmenu=customers_bills",$langs->trans("NewBill"),1,$user->rights->facture->creer); - } + $newmenu->add("/compta/facture.php?action=create&leftmenu=customers_bills",$langs->trans("NewBill"),1,$user->rights->facture->creer); $newmenu->add("/compta/facture/fiche-rec.php?leftmenu=customers_bills",$langs->trans("Repeatables"),1,$user->rights->facture->lire); $newmenu->add("/compta/facture/impayees.php?leftmenu=customers_bills",$langs->trans("Unpaid"),1,$user->rights->facture->lire); @@ -778,10 +762,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("bills"); $newmenu->add("/fourn/facture/list.php?leftmenu=suppliers_bills", $langs->trans("BillsSuppliers"),0,$user->rights->fournisseur->facture->lire, '', $mainmenu, 'suppliers_bills'); - if (empty($user->societe_id)) - { - $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); - } + $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"),1,$user->rights->fournisseur->facture->creer); $newmenu->add("/fourn/facture/impayees.php", $langs->trans("Unpaid"),1,$user->rights->fournisseur->facture->lire); $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire); @@ -959,11 +940,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->product->enabled)) { $newmenu->add("/product/index.php?leftmenu=product&type=0", $langs->trans("Products"), 0, $user->rights->produit->lire, '', $mainmenu, 'product'); - if (empty($user->societe_id)) - { - $newmenu->add("/product/fiche.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); - $newmenu->add("/product/liste.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); - } + $newmenu->add("/product/fiche.php?leftmenu=product&action=create&type=0", $langs->trans("NewProduct"), 1, $user->rights->produit->creer); + $newmenu->add("/product/liste.php?leftmenu=product&type=0", $langs->trans("List"), 1, $user->rights->produit->lire); if (! empty($conf->propal->enabled)) { $newmenu->add("/product/popuprop.php?leftmenu=stats&type=0", $langs->trans("Statistics"), 1, $user->rights->produit->lire && $user->rights->propale->lire); @@ -978,10 +956,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu if (! empty($conf->service->enabled)) { $newmenu->add("/product/index.php?leftmenu=service&type=1", $langs->trans("Services"), 0, $user->rights->service->lire, '', $mainmenu, 'service'); - if (empty($user->societe_id)) - { - $newmenu->add("/product/fiche.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); - } + $newmenu->add("/product/fiche.php?leftmenu=service&action=create&type=1", $langs->trans("NewService"), 1, $user->rights->service->creer); $newmenu->add("/product/liste.php?leftmenu=service&type=1", $langs->trans("List"), 1, $user->rights->service->lire); if (! empty($conf->propal->enabled)) { @@ -994,10 +969,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=0", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=0", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=0", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } @@ -1039,10 +1011,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu $newmenu->add("/fourn/index.php?leftmenu=suppliers", $langs->trans("Suppliers"), 0, $user->rights->societe->lire && $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers'); // Security check - if (empty($user->societe_id)) - { - $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire); - } + $newmenu->add("/societe/soc.php?leftmenu=suppliers&action=create&type=f",$langs->trans("NewSupplier"), 1, $user->rights->societe->creer && $user->rights->fournisseur->lire); $newmenu->add("/fourn/liste.php",$langs->trans("List"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire); $newmenu->add("/contact/list.php?leftmenu=suppliers&type=f",$langs->trans("Contacts"), 1, $user->rights->societe->contact->lire && $user->rights->fournisseur->lire); $newmenu->add("/fourn/stats.php",$langs->trans("Statistics"), 1, $user->rights->societe->lire && $user->rights->fournisseur->lire); @@ -1052,12 +1021,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("bills"); $newmenu->add("/fourn/facture/list.php?leftmenu=orders", $langs->trans("Bills"), 0, $user->rights->fournisseur->facture->lire, '', $mainmenu, 'orders'); - - if (empty($user->societe_id)) - { - $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer); - } - + $newmenu->add("/fourn/facture/fiche.php?action=create",$langs->trans("NewBill"), 1, $user->rights->fournisseur->facture->creer); $newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"), 1, $user->rights->fournisseur->facture->lire); } @@ -1073,10 +1037,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=1", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=1", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } @@ -1196,10 +1157,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu { $langs->load("categories"); $newmenu->add("/categories/index.php?leftmenu=cat&type=3", $langs->trans("Categories"), 0, $user->rights->categorie->lire, '', $mainmenu, 'cat'); - if (empty($user->societe_id)) - { - $newmenu->add("/categories/fiche.php?action=create&type=3", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); - } + $newmenu->add("/categories/fiche.php?action=create&type=3", $langs->trans("NewCategory"), 1, $user->rights->categorie->creer); //if (empty($leftmenu) || $leftmenu=="cat") $newmenu->add("/categories/liste.php", $langs->trans("List"), 1, $user->rights->categorie->lire); } diff --git a/htdocs/core/modules/barcode/phpbarcode.modules.php b/htdocs/core/modules/barcode/phpbarcode.modules.php index f5c8d596c70..2d29405ed9e 100644 --- a/htdocs/core/modules/barcode/phpbarcode.modules.php +++ b/htdocs/core/modules/barcode/phpbarcode.modules.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2013 Laurent Destailleur * Copyright (C) 2005 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -20,15 +20,15 @@ /** * \file htdocs/core/modules/barcode/phpbarcode.modules.php * \ingroup barcode - * \brief Fichier contenant la classe du modele de generation code barre phpbarcode + * \brief File with class to generate barcode images using php barcode generator */ require_once DOL_DOCUMENT_ROOT.'/core/modules/barcode/modules_barcode.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/barcode.lib.php'; // This is to include def like $genbarcode_loc and $font_loc -/** \class modPhpbarcode - * \brief Classe du modele de numerotation de generation code barre phpbarcode +/** + * Class to generate barcode images using php barcode generator */ class modPhpbarcode extends ModeleBarCode { @@ -77,7 +77,7 @@ class modPhpbarcode extends ModeleBarCode /** - * Return true if encodinf is supported + * Return true if encoding is supported * * @param string $encoding Encoding norm * @return int >0 if supported, 0 if not @@ -108,9 +108,10 @@ class modPhpbarcode extends ModeleBarCode * @param string $code Value to encode * @param string $encoding Mode of encoding * @param string $readable Code can be read + * @param string $scale Scale * @return int <0 if KO, >0 if OK */ - function buildBarCode($code,$encoding,$readable='Y') + function buildBarCode($code,$encoding,$readable='Y',$scale=1) { global $_GET,$_SERVER; global $conf; @@ -121,7 +122,7 @@ class modPhpbarcode extends ModeleBarCode if ($encoding == 'EAN8' || $encoding == 'EAN13') $encoding = 'EAN'; if ($encoding == 'C39' || $encoding == 'C128') $encoding = substr($encoding,1); - $scale=1; $mode='png'; + $mode='png'; $_GET["code"]=$code; $_GET["encoding"]=$encoding; @@ -147,9 +148,10 @@ class modPhpbarcode extends ModeleBarCode * @param string $code Value to encode * @param string $encoding Mode of encoding * @param string $readable Code can be read + * @param string $scale Scale * @return int <0 if KO, >0 if OK */ - function writeBarCode($code,$encoding,$readable='Y') + function writeBarCode($code,$encoding,$readable='Y',$scale=1) { global $conf,$filebarcode; @@ -159,7 +161,7 @@ class modPhpbarcode extends ModeleBarCode $filebarcode=$file; // global var to be used in barcode_outimage called by barcode_print in buildBarCode - $result=$this->buildBarCode($code,$encoding,$readable); + $result=$this->buildBarCode($code,$encoding,$readable,$scale); return $result; } diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index f12b1e333b0..7c0d4c4a53e 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -51,6 +51,7 @@ */ 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'; @@ -124,12 +125,16 @@ class pdf_standard * @param Translate $outputlangs Output langs * @param string $textright Text right * @param int $idmember Id member - * @param string $photo Photo (path to image file used as replacement for key %PHOTOS% into left, right header or footer text) + * @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) // We are in a new page, then we must add a page if (($this->_COUNTX ==0) and ($this->_COUNTY==0) and (!$this->_First==1)) { @@ -194,50 +199,67 @@ class pdf_standard $pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($header),0,1,'C'); } + + $xleft=2; $ytop=2+(empty($header)?0:1+$this->_Line_Height); + $maxwidthtouse=round(($this->_Width - 2*$xleft)*$imgscalewidth); $maxheighttouse=round(($this->_Height - 2*$ytop)*$imgscaleheight); + $defaultratio=($maxwidthtouse/$maxheighttouse); + + // Define widthtouse and heighttouse + $widthtouse=$maxwidthtouse; $heighttouse=0; // old value for image + $tmp=dol_getImageSize($photo, false); + if ($tmp['height']) + { + $imgratio=$tmp['width']/$tmp['height']; + if ($imgratio >= $defaultratio) { $widthtouse = $maxwidthtouse; $heighttouse = round($widthtouse / $imgratio); } + else { $heightouse = $maxheighttouse; $widthtouse = round($heightouse * $imgratio); } + } + //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 { - if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + // Output left area + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); else { - $pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); + $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); } } else if ($textleft!='' && $textright!='') // { if ($textleft == '%LOGO%' || $textleft == '%PHOTO%') { - if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - $pdf->SetXY($_PosX+21, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + $pdf->SetXY($_PosX+$xleft+$widthtouse+1, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$xleft-$xleft-$widthtouse-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); } else if ($textright == '%LOGO%' || $textright == '%PHOTO%') { - if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20); - else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20); - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$widthtouse-$xleft-$xleft-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); } - else + else // text on halft left and text on half right { - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell(round($this->_Width/2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); - $pdf->SetXY($_PosX+round($this->_Width/2), $_PosY+3+$this->_Line_Height); + $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 { - if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); - else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); + // Output right area + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); else { - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); } } diff --git a/htdocs/core/modules/modBarcode.class.php b/htdocs/core/modules/modBarcode.class.php index 899ad76b9fc..dc2614bdfcb 100644 --- a/htdocs/core/modules/modBarcode.class.php +++ b/htdocs/core/modules/modBarcode.class.php @@ -96,14 +96,16 @@ class modBarcode extends DolibarrModules // Main menu entries $r=0; - $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=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', - 'langs'=>'cron', // 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'=>200, - 'enabled'=>'$leftmenu==\'modulesadmintools\' && $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 + '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++; diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index 6154ead565d..4f85ccdf09d 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -51,6 +51,7 @@ */ 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'; @@ -116,20 +117,24 @@ class pdf_standardlabel * - %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 + * @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='') { global $mysoc,$conf,$langs; + global $forceimgscalewidth,$forceimgscaleheight; - // We are in a new page, then we must add a page + $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) and ($this->_COUNTY==0) and (!$this->_First==1)) { $pdf->AddPage(); } @@ -182,14 +187,31 @@ class pdf_standardlabel $pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($header),0,1,'C'); } + + $xleft=2; $ytop=2+(empty($header)?0:1+$this->_Line_Height); + $maxwidthtouse=round(($this->_Width - 2*$xleft)*$imgscalewidth); $maxheighttouse=round(($this->_Height - 2*$ytop)*$imgscaleheight); + $defaultratio=($maxwidthtouse/$maxheighttouse); + + // Define widthtouse and heighttouse + $widthtouse=$maxwidthtouse; $heighttouse=0; // old value for image + $tmp=dol_getImageSize($photo, false); + if ($tmp['height']) + { + $imgratio=$tmp['width']/$tmp['height']; + if ($imgratio >= $defaultratio) { $widthtouse = $maxwidthtouse; $heighttouse = round($widthtouse / $imgratio); } + else { $heightouse = $maxheighttouse; $widthtouse = round($heightouse * $imgratio); } + } + //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 { - if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + // Output left area + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); else { - $pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); } } @@ -197,34 +219,35 @@ class pdf_standardlabel { if ($textleft == '%LOGO%' || $textleft == '%PHOTO%') { - if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); - $pdf->SetXY($_PosX+21, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + $pdf->SetXY($_PosX+$xleft+$widthtouse+1, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$xleft-$xleft-$widthtouse-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); } else if ($textright == '%LOGO%' || $textright == '%PHOTO%') { - if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20); - else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+3+$this->_Line_Height,20); - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width-22, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$widthtouse-$xleft-$xleft-1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft),0,'L'); } - else + else // text on halft left and text on half right { - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); + $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+3+$this->_Line_Height); + $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 { - if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); - else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); + // Output right area + if ($textright == '%LOGO%' && $logo) $pdf->Image($logo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); + else if ($textright == '%PHOTO%' && $photo) $pdf->Image($photo,$_PosX+$this->_Width-$widthtouse-$xleft,$_PosY+$ytop,$widthtouse,$heighttouse); else { - $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); - $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + $pdf->SetXY($_PosX+$xleft, $_PosY+$ytop); + $pdf->MultiCell($this->_Width-$xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); } } diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 48f6b8489e6..806c3a4d083 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -203,4 +203,14 @@ ServiceSellByQuarterHT=Services turnover quarterly VWAP Quarter1=1st. Quarter Quarter2=2nd. Quarter Quarter3=3rd. Quarter -Quarter4=4th. Quarter \ No newline at end of file +Quarter4=4th. Quarter +BarCodePrintsheet=Imprimer code barre +PageToGenerateBarCodeSheets=With this tool, you can print sheets of bar code stickers. Choose format of your sticker page, type of barcode and value of barcode, then click on button %s. +NumberOfStickers=Number of stickers to print on page +PrintsheetForOneBarCode=Print several stickers for one barcode +BuildPageToPrint=Generate page to print +FillBarCodeTypeAndValueManually=Fill barcode type and value manually +FillBarCodeTypeAndValueFromProduct=Fill barcode type and value from a product +FillBarCodeTypeAndValueFromThirdParty=Fill barcode type and value from a thirdparty +BarcodeStickersMask=xxx + \ No newline at end of file diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index 942eb67897f..df987ff22d3 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -204,3 +204,12 @@ Quarter1=1er trimestre Quarter2=2eme trimestre Quarter3=3eme trimestre Quarter4=4eme trimestre +BarCodePrintsheet=Imprimer code barre +PageToGenerateBarCodeSheets=Avec cet outils, vous pouvez imprimer une planche d'étiquette de code-barres. Sélectionner votre format de planche d'étiquette, le type de code-barre et la valeur du code-barre puis cliquer sur le bouton %s. +NumberOfStickers=Nombre d'étiquettes à imprimer sur la/les planches +PrintsheetForOneBarCode=Imprimer des étiquettes d'un code barre particulier +BuildPageToPrint=Générer la page à imprimer +FillBarCodeTypeAndValueManually=Remplir le type et la valeur du code barre manuellement +FillBarCodeTypeAndValueFromProduct=Remplir le type et la valeur du code barre depuis un produit +FillBarCodeTypeAndValueFromThirdParty=Remplir le type et la valeur du code barre depuis un tiers +BarcodeStickersMask=xxx \ No newline at end of file diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index ec258dda9d8..a1c2d641b71 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -158,7 +158,14 @@ if ($socid) if (! empty($conf->agenda->enabled)) { - print ''.$langs->trans("AddAction").''; + if (! empty($user->rights->agenda->myactions->create) || ! empty($user->rights->agenda->allactions->create)) + { + print ''.$langs->trans("AddAction").''; + } + else + { + print ''.$langs->trans("AddAction").''; + } } print ''; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index c5ca713f9f5..ca83d9e0a53 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -1576,12 +1576,12 @@ else // Country print ''.$langs->trans("Country").''; - if ($object->country_code) - { - $img=picto_from_langcode($object->country_code); - if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); - else print ($img?$img.' ':'').$object->country; - } + if (! empty($object->country_code)) + { + $img=picto_from_langcode($object->country_code); + if ($object->isInEEC()) print $form->textwithpicto(($img?$img.' ':'').$object->country,$langs->trans("CountryIsInEEC"),1,0); + else print ($img?$img.' ':'').$object->country; + } print ''; // State