diff --git a/build/makepack-howto.txt b/build/makepack-howto.txt index 44d96f3c109..5c09cbdb7a5 100644 --- a/build/makepack-howto.txt +++ b/build/makepack-howto.txt @@ -9,15 +9,13 @@ beta version of Dolibarr, step by step. - Check all files are commited. - Update version/info in / directory (README*.txt, ChangeLog...) -- Update version number with x.x.x in build/doxygen/dolibarr-doxygen.doxyfile -- Update version number with x.x.x in build/perl/virtualmin/dolibarr.pl +- Update version number with x.x.x-y in htdocs/filefunc.inc.php - Update version number with x.x.x-y in build/makepack-dolibarr.pl - Update version number with x.x.x-y in build/debian/changelog - Update version number with x.x.x-y in build/exe/doliwamp/doliwamp.iss -- Update version number with x.x.x-y in htdocs/filefunc.inc.php -- Update version number with x.x.x-y in htdocs/install/inc.php -- Update version number with x.x.x-y in htdocs/support/inc.php -- Update version number with x.x.x-y in htdocs/build/rpm/*.spec +- Update version number with x.x.x-y in build/rpm/*.spec +- Update version number with x.x.x in build/doxygen/dolibarr-doxygen.doxyfile +- Update version number with x.x.x in build/perl/virtualmin/dolibarr.pl - Commit all changes. - Add a Tag (DOLIBARR_x_y_BETA) - Create a branch (DOLIBARR_x_y_BRANCH). @@ -35,12 +33,11 @@ complete release of Dolibarr, step by step. - Check all files are commited. - Update version/info in / directory (README*.txt, ChangeLog...) -- Update version number with x.x.x-y in build/makepack-dolibarr.pl -- Update version number with x.x.x-y in build/exe/doliwamp/doliwamp.iss - Update version number with x.x.x-y in htdocs/filefunc.inc.php -- Update version number with x.x.x-y in htdocs/install/inc.php -- Update version number with x.x.x-y in htdocs/support/inc.php -- Update version number with x.x.x-y in htdocs/build/rpm/*.spec +- Update version number with x.x.x-y in build/makepack-dolibarr.pl +- Update version number with x.x.x-y in build/debian/changelog +- Update version number with x.x.x-y in build/exe/doliwamp/doliwamp.iss +- Update version number with x.x.x-y in build/rpm/*.spec - Update PAD files. - Commit all changes. - Add a Tag (DOLIBARR_x_y) diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index c636200bdf4..a5a66d37721 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -218,10 +218,9 @@ print_fiche_titre($langs->trans("MembersCards"),'',''); form_constantes($constantes); print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; -print '%DOL_MAIN_URL_ROOT%, %ID%, %PRENOM%, %NOM%, %LOGIN%, %PASSWORD%, '; -print '%SOCIETE%, %ADRESSE%, %CP%, %VILLE%, %PAYS%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, '; +print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, '; +print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, '; print '%YEAR%, %MONTH%, %DAY%'; -//print '%INFOS%'; Deprecated print '
'; print '
'; @@ -230,12 +229,18 @@ print '
'; /* * Edition info modele document */ -$constantes=array('ADHERENT_ETIQUETTE_TYPE'); +$constantes=array('ADHERENT_ETIQUETTE_TYPE','ADHERENT_ETIQUETTE_TEXT'); print_fiche_titre($langs->trans("MembersTickets"),'',''); form_constantes($constantes); +print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; +print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, '; +print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, '; +print '%YEAR%, %MONTH%, %DAY%'; +print '
'; + print '
'; @@ -259,10 +264,9 @@ print_fiche_titre($langs->trans("Other"),'',''); form_constantes($constantes); print '*'.$langs->trans("FollowingConstantsWillBeSubstituted").'
'; -print '%DOL_MAIN_URL_ROOT%, %ID%, %PRENOM%, %NOM%, %LOGIN%, %PASSWORD%,'; -print '%SOCIETE%, %ADRESSE%, %CP%, %VILLE%, %PAYS%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%'; +print '%DOL_MAIN_URL_ROOT%, %ID%, %FIRSTNAME%, %LASTNAME%, %FULLNAME%, %LOGIN%, %PASSWORD%, '; +print '%COMPANY%, %ADDRESS%, %ZIP%, %TOWN%, %COUNTRY%, %EMAIL%, %NAISS%, %PHOTO%, %TYPE%, '; //print '%YEAR%, %MONTH%, %DAY%'; // Not supported -//print '%INFOS%'; Deprecated print '
'; dol_fiche_end(); diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index e0b8fca05e7..28475d03571 100755 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -23,10 +23,11 @@ * \brief Page to output members business cards */ require("../../main.inc.php"); +require_once(DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'); require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php"); require_once(DOL_DOCUMENT_ROOT."/adherents/class/adherent.class.php"); -require_once(DOL_DOCUMENT_ROOT."/core/modules/member/cards/modules_cards.php"); -require_once(DOL_DOCUMENT_ROOT."/core/modules/member/labels/modules_labels.php"); +require_once(DOL_DOCUMENT_ROOT."/core/modules/member/modules_cards.php"); +require_once(DOL_DOCUMENT_ROOT."/core/modules/printsheet/modules_labels.php"); $langs->load("members"); $langs->load("errors"); @@ -39,12 +40,15 @@ $day=dol_print_date($now,'%d'); $foruserid=GETPOST('foruserid'); $foruserlogin=GETPOST('foruserlogin'); $mode=GETPOST('mode'); - +$model=GETPOST("model"); // Doc template to use for business cards +$modellabel=GETPOST("modellabel"); // Doc template to use for address sheet $mesg=''; +$adherentstatic=new Adherent($db); + /* - * View + * Actions */ if ($mode == 'cardlogin' && empty($foruserlogin)) @@ -57,10 +61,10 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg $arrayofmembers=array(); // requete en prenant que les adherents a jour de cotisation - $sql = "SELECT d.rowid, d.prenom as firstname, d.nom as lastname, d.login, d.societe, d.datefin,"; - $sql.= " d.adresse, d.cp, d.ville, d.naiss, d.email, d.photo,"; + $sql = "SELECT d.rowid, d.prenom as firstname, d.nom as lastname, d.login, d.societe as company, d.datefin,"; + $sql.= " d.adresse as address, d.cp as zip, d.ville as town, d.naiss, d.email, d.photo,"; $sql.= " t.libelle as type,"; - $sql.= " p.libelle as pays"; + $sql.= " p.code as country_code, p.libelle as country"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t, ".MAIN_DB_PREFIX."adherent as d"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_pays as p ON d.pays = p.rowid"; $sql.= " WHERE d.fk_adherent_type = t.rowid AND d.statut = 1"; @@ -68,6 +72,7 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg if ($foruserlogin) $sql.=" AND d.login='".$db->escape($foruserlogin)."'"; $sql.= " ORDER BY d.rowid ASC"; + dol_syslog("Search members sql=".$sql); $result = $db->query($sql); if ($result) { @@ -77,27 +82,42 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg { $objp = $db->fetch_object($result); - if ($objp->pays == '-') $objp->pays=''; + if ($objp->country == '-') $objp->country=''; + + $adherentstatic->lastname=$objp->lastname; + $adherentstatic->firstname=$objp->firstname; // List of values to scan for a replacement $substitutionarray = array ( - '%PRENOM%'=>$objp->firstname, - '%NOM%'=>$objp->lastname, + '%ID%'=>$objp->rowid, '%LOGIN%'=>$objp->login, - '%SERVEUR%'=>"http://".$_SERVER["SERVER_NAME"]."/", - '%SOCIETE%'=>$objp->societe, - '%ADRESSE%'=>$objp->adresse, - '%CP%'=>$objp->cp, - '%VILLE%'=>$objp->ville, - '%PAYS%'=>$objp->pays, + '%FIRSTNAME%'=>$objp->firstname, + '%LASTNAME%'=>$objp->lastname, + '%FULLNAME%'=>$adherentstatic->getFullName($langs), + '%COMPANY%'=>$objp->company, + '%ADDRESS%'=>$objp->address, + '%ZIP%'=>$objp->zip, + '%TOWN%'=>$objp->town, + '%COUNTRY%'=>$objp->country, + '%COUNTRY_CODE%'=>$objp->country_code, '%EMAIL%'=>$objp->email, '%NAISS%'=>dol_print_date($objp->naiss,'day'), '%TYPE%'=>$objp->type, - '%ID%'=>$objp->rowid, - '%ANNEE%'=>$year, // For backward compatibility '%YEAR%'=>$year, '%MONTH%'=>$month, - '%DAY%'=>$day + '%DAY%'=>$day, + '%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT, + '%SERVER%'=>"http://".$_SERVER["SERVER_NAME"]."/", // deprecated + // For backward compatibility + '%PRENOM%'=>$objp->firstname, + '%NOM%'=>$objp->lastname, + '%SOCIETE%'=>$objp->company, + '%ADRESSE%'=>$objp->address, + '%CP%'=>$objp->zip, + '%VILLE%'=>$objp->town, + '%PAYS%'=>$objp->country, + '%ANNEE%'=>$year, + '%SERVEUR%'=>"http://".$_SERVER["SERVER_NAME"]."/" // deprecated ); complete_substitutions_array($substitutionarray, $langs); @@ -113,29 +133,33 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg { for($j=0;$j<100;$j++) { - $arrayofmembers[]=array('textleft'=>$textleft, - 'textheader'=>$textheader, - 'textfooter'=>$textfooter, - 'textright'=>$textright, - 'id'=>$objp->rowid, - 'photo'=>$objp->photo); + $arrayofmembers[]=array( + 'textleft'=>$textleft, + 'textheader'=>$textheader, + 'textfooter'=>$textfooter, + 'textright'=>$textright, + 'id'=>$objp->rowid, + 'photo'=>$objp->photo + ); } } else { - $arrayofmembers[]=array('textleft'=>$textleft, - 'textheader'=>$textheader, - 'textfooter'=>$textfooter, - 'textright'=>$textright, - 'id'=>$objp->rowid, - 'photo'=>$objp->photo); + $arrayofmembers[]=array( + 'textleft'=>$textleft, + 'textheader'=>$textheader, + 'textfooter'=>$textfooter, + 'textright'=>$textright, + 'id'=>$objp->rowid, + 'photo'=>$objp->photo + ); } } // For labels if ($mode == 'label') { - $conf->global->ADHERENT_ETIQUETTE_TEXT="%PRENOM% %NOM%\n%ADRESSE%\n%CP% %VILLE%\n%PAYS%"; + if (empty($conf->global->ADHERENT_ETIQUETTE_TEXT)) $conf->global->ADHERENT_ETIQUETTE_TEXT="%FULLNAME%\n%ADDRESS%\n%ZIP% %TOWN%\n%COUNTRY%"; $textleft=make_substitutions($conf->global->ADHERENT_ETIQUETTE_TEXT, $substitutionarray); $textheader=''; $textfooter=''; @@ -153,19 +177,30 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg } // Build and output PDF - if (empty($mode) || $mode=='card' || $mode='cardlogin') + if (empty($mode) || $mode=='card' || $mode=='cardlogin') { if (! count($arrayofmembers)) { $mesg=$langs->trans("ErrorRecordNotFound"); } - - if (! $mesg) $result=members_card_pdf_create($db, $arrayofmembers, '', $outputlangs); + if (empty($model) || $model == '-1') + { + $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DescADHERENT_CARD_TYPE")); + } + if (! $mesg) $result=members_card_pdf_create($db, $arrayofmembers, $model, $outputlangs); } elseif ($mode == 'label') { - $result=members_label_pdf_create($db, $arrayofmembers, '', $outputlangs); + if (! count($arrayofmembers)) + { + $mesg=$langs->trans("ErrorRecordNotFound"); + } + if (empty($modellabel) || $modellabel == '-1') + { + $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("DescADHERENT_ETIQUETTE_TYPE")); + } + if (! $mesg) $result=members_label_pdf_create($db, $arrayofmembers, $modellabel, $outputlangs); } if ($result <= 0) @@ -178,12 +213,19 @@ if ((! empty($foruserid) || ! empty($foruserlogin) || ! empty($mode)) && ! $mesg dol_print_error($db); } - if (! $mesg) exit; + if (! $mesg) + { + $db->close(); + exit; + } } +/* + * View + */ - +$form=new Form($db); llxHeader('',$langs->trans("MembersCards")); @@ -195,26 +237,53 @@ print '
'; dol_htmloutput_errors($mesg); -print $langs->trans("DocForAllMembersCards",($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; +print img_picto('','puce').' '.$langs->trans("DocForAllMembersCards",($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print '
'; print ''; print ''; -print ' '; +print ''; +print $langs->trans("DescADHERENT_CARD_TYPE").' '; +// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) +$arrayoflabels=array(); +foreach(array_keys($_Avery_Labels) as $codecards) +{ + $arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name']; +} +print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0); +print '
'; print '
'; print '
'; -print $langs->trans("DocForOneMemberCards",($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; +print img_picto('','puce').' '.$langs->trans("DocForOneMemberCards",($conf->global->ADHERENT_CARD_TYPE?$conf->global->ADHERENT_CARD_TYPE:$langs->transnoentitiesnoconv("None"))).' '; print '
'; print ''; -print $langs->trans("Login").': '; -print ' '; +print ''; +print $langs->trans("DescADHERENT_CARD_TYPE").' '; +// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) +$arrayoflabels=array(); +foreach(array_keys($_Avery_Labels) as $codecards) +{ + $arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name']; +} +print $form->selectarray('model',$arrayoflabels,(GETPOST('model')?GETPOST('model'):$conf->global->ADHERENT_CARD_TYPE),1,0,0); +print '
'.$langs->trans("Login").': '; +print '
'; print '
'; print '
'; -print $langs->trans("DocForLabels",$conf->global->ADHERENT_ETIQUETTE_TYPE).' '; +print img_picto('','puce').' '.$langs->trans("DocForLabels",$conf->global->ADHERENT_ETIQUETTE_TYPE).' '; print '
'; print ''; -print ' '; +print ''; +print $langs->trans("DescADHERENT_ETIQUETTE_TYPE").' '; +// List of possible labels (defined into $_Avery_Labels variable set into format_cards.lib.php) +$arrayoflabels=array(); +foreach(array_keys($_Avery_Labels) as $codecards) +{ + $arrayoflabels[$codecards]=$_Avery_Labels[$codecards]['name']; +} +print $form->selectarray('modellabel',$arrayoflabels,(GETPOST('modellabel')?GETPOST('modellabel'):$conf->global->ADHERENT_ETIQUETTE_TYPE),1,0,0); +print '
'; print '
'; print '
'; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 709d7690c74..da6bc37bd87 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -212,8 +212,22 @@ class Adherent extends CommonObject $substitutionarray=array( '%DOL_MAIN_URL_ROOT%'=>DOL_MAIN_URL_ROOT, '%ID%'=>$msgishtml?dol_htmlentitiesbr($this->id):$this->id, - '%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos, '%CIVILITE%'=>$this->getCivilityLabel($msgishtml?0:1), + '%FIRSTNAME%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, + '%LASTNAME%'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname, + '%FULLNAME%'=>$msgishtml?dol_htmlentitiesbr($this->getFullName($langs)):$this->getFullName($langs), + '%COMPANY%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe, + '%ADDRESS%'=>$msgishtml?dol_htmlentitiesbr($this->address):$this->address, + '%ZIP%'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip, + '%TOWN%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town, + '%COUNTRY%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country, + '%EMAIL%'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email, + '%NAISS%'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday, + '%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo, + '%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login, + '%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass, + // For backward compatibility + '%INFOS%'=>$msgishtml?dol_htmlentitiesbr($infos):$infos, '%PRENOM%'=>$msgishtml?dol_htmlentitiesbr($this->firstname):$this->firstname, '%NOM%'=>$msgishtml?dol_htmlentitiesbr($this->lastname):$this->lastname, '%SOCIETE%'=>$msgishtml?dol_htmlentitiesbr($this->societe):$this->societe, @@ -221,11 +235,6 @@ class Adherent extends CommonObject '%CP%'=>$msgishtml?dol_htmlentitiesbr($this->zip):$this->zip, '%VILLE%'=>$msgishtml?dol_htmlentitiesbr($this->town):$this->town, '%PAYS%'=>$msgishtml?dol_htmlentitiesbr($this->country):$this->country, - '%EMAIL%'=>$msgishtml?dol_htmlentitiesbr($this->email):$this->email, - '%NAISS%'=>$msgishtml?dol_htmlentitiesbr($birthday):$birthday, - '%PHOTO%'=>$msgishtml?dol_htmlentitiesbr($this->photo):$this->photo, - '%LOGIN%'=>$msgishtml?dol_htmlentitiesbr($this->login):$this->login, - '%PASSWORD%'=>$msgishtml?dol_htmlentitiesbr($this->pass):$this->pass ); complete_substitutions_array($substitutionarray, $langs); diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index d1f838056d4..789d4f7361d 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2011 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010 Juanjo Menent * Copyright (C) 2011 Philippe Grand @@ -137,7 +137,7 @@ if ( ($action == 'update' && empty($_POST["cancel"])) dolibarr_set_const($db, "MAIN_INFO_SIRET",$_POST["siret"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_APE",$_POST["ape"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_RCS",$_POST["rcs"],'chaine',0,'',$conf->entity); - dolibarr_set_const($db, "MAIN_INFO_TRAINER",$_POST["trainer"],'chaine',0,'',$conf->entity); + dolibarr_set_const($db, "MAIN_INFO_PROFID5",$_POST["MAIN_INFO_PROFID5"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_PROFID6",$_POST["MAIN_INFO_PROFID6"],'chaine',0,'',$conf->entity); dolibarr_set_const($db, "MAIN_INFO_TVAINTRA",$_POST["tva"],'chaine',0,'',$conf->entity); @@ -481,7 +481,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''.$langs->transcountry("ProfId5",$country_code).''; if ($country_code) { - print ''; + print ''; } else { @@ -818,7 +818,7 @@ else print ''.$langs->transcountry("ProfId5",$country_code).''; if ($langs->transcountry("ProfId5",$country_code) != '-') { - print $conf->global->MAIN_INFO_TRAINER; + print $conf->global->MAIN_INFO_PROFID5; } print ''; } diff --git a/htdocs/bookmarks/fiche.php b/htdocs/bookmarks/fiche.php index 67bd962e747..808e1faf162 100644 --- a/htdocs/bookmarks/fiche.php +++ b/htdocs/bookmarks/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2009 Laurent Destailleur + * Copyright (C) 2005-2012 Laurent Destailleur * * 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 @@ -28,12 +28,12 @@ require_once(DOL_DOCUMENT_ROOT."/bookmarks/class/bookmark.class.php"); $langs->load("other"); -$action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; -$title=isset($_GET["title"])?$_GET["title"]:$_POST["title"]; -$url=isset($_GET["url"])?$_GET["url"]:$_POST["url"]; -$target=isset($_GET["target"])?$_GET["target"]:$_POST["target"]; -$userid=isset($_GET["userid"])?$_GET["userid"]:$_POST["userid"]; -$position=isset($_GET["position"])?$_GET["position"]:$_POST["position"]; +$action=GETPOST("action"); +$title=GETPOST("title"); +$url=GETPOST("url"); +$target=GETPOST("target"); +$userid=GETPOST("userid"); +$position=GETPOST("position"); /* @@ -139,7 +139,9 @@ if ($action == 'create') print_fiche_titre($langs->trans("NewBookmark")); - if ($mesg) print "$mesg
"; + dol_fiche_head($head, $hselected, $langs->trans("Bookmark"),0,'bookmark'); + + dol_htmloutput_mesg($mesg); print ''; @@ -159,16 +161,18 @@ if ($action == 'create') // Position print ''; + print ''; - print '
'.$langs->trans("Position").''; print 'position).'">'; - print '
 
'; + print '

'; + + print '
'; print '   '; print ''; - print ''; - - print ''; + print '
'; print ''; + + dol_fiche_end(); } @@ -248,17 +252,13 @@ if ($_GET["id"] > 0 && ! preg_match('/^add/i',$_GET["action"])) // Date creation print ''.$langs->trans("DateCreation").''.dol_print_date($bookmark->datec,'dayhour').''; - if ($_GET["action"] == 'edit') print '     '; - - print ''; + if ($_GET["action"] == 'edit') print '
   
'; + if ($_GET["action"] == 'edit') print ''; - - - print "\n"; - + dol_fiche_end(); print "
\n"; diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index ca74e4384bc..beff42d7840 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -376,7 +376,7 @@ class DoliDBPgsql //if (! $name) $name="postgres"; // try first Unix domain socket (local) - if (! $host || $host == "" || $host == "localhost" || $host == "127.0.0.1") + if ((! $host || $host == "" || $host == "localhost" || $host == "127.0.0.1") && ! defined('NOLOCALSOCKETPGCONNECT')) { $con_string = "dbname='".$name."' user='".$login."' password='".$passwd."'"; $this->db = pg_connect($con_string); diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 8d597eba70e..bee8f11d60a 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -1081,9 +1081,9 @@ function form_constantes($tableau) { print ''; //print 'aa'.$const; - if (in_array($const,array('ADHERENT_CARD_TEXT','ADHERENT_CARD_TEXT_RIGHT'))) + if (in_array($const,array('ADHERENT_CARD_TEXT','ADHERENT_CARD_TEXT_RIGHT','ADHERENT_ETIQUETTE_TEXT'))) { - print '\n"; print ''; @@ -1192,4 +1192,4 @@ function delDocumentModel($name, $type) } } -?> \ No newline at end of file +?> diff --git a/htdocs/core/lib/format_cards.lib.php b/htdocs/core/lib/format_cards.lib.php index fb758aefb24..4f37051505a 100644 --- a/htdocs/core/lib/format_cards.lib.php +++ b/htdocs/core/lib/format_cards.lib.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2012 Laurent Destailleur * Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007 Patrick Raguin * @@ -25,12 +25,11 @@ */ - global $_Avery_Labels; $_Avery_Labels = array ( - '5160'=>array('name'=>'5160', + '5160'=>array('name'=>'5160 (Letter)', 'paper-size'=>'letter', 'metric'=>'mm', 'marginLeft'=>1.762, @@ -42,7 +41,7 @@ $_Avery_Labels = array ( 'width'=>66.675, 'height'=>25.4, 'font-size'=>8), - '5161'=>array('name'=>'5161', + '5161'=>array('name'=>'5161 (Letter)', 'paper-size'=>'letter', 'metric'=>'mm', 'marginLeft'=>0.967, @@ -54,7 +53,7 @@ $_Avery_Labels = array ( 'width'=>101.6, 'height'=>25.4, 'font-size'=>8), - '5162'=>array('name'=>'5162', + '5162'=>array('name'=>'5162 (Letter)', 'paper-size'=>'letter', 'metric'=>'mm', 'marginLeft'=>0.97, @@ -66,7 +65,7 @@ $_Avery_Labels = array ( 'width'=>100.807, 'height'=>35.72, 'font-size'=>8), - '5163'=>array('name'=>'5163', + '5163'=>array('name'=>'5163 (Letter)', 'paper-size'=>'letter', 'metric'=>'mm', 'marginLeft'=>1.762, @@ -78,7 +77,7 @@ $_Avery_Labels = array ( 'width'=>101.6, 'height'=>50.8, 'font-size'=>8), - '5164'=>array('name'=>'5164', + '5164'=>array('name'=>'5164 (Letter)', 'paper-size'=>'letter', 'metric'=>'in', 'marginLeft'=>0.148, @@ -90,7 +89,7 @@ $_Avery_Labels = array ( 'width'=>4.0, 'height'=>3.33, 'font-size'=>12), - '8600'=>array('name'=>'8600', + '8600'=>array('name'=>'8600 (Letter)', 'paper-size'=>'letter', 'metric'=>'mm', 'marginLeft'=>7.1, @@ -102,7 +101,7 @@ $_Avery_Labels = array ( 'width'=>66.6, 'height'=>25.4, 'font-size'=>8), - 'L7163'=>array('name'=>'L7163', + 'L7163'=>array('name'=>'L7163 (A4)', 'paper-size'=>'A4', 'metric'=>'mm', 'marginLeft'=>5, @@ -114,7 +113,7 @@ $_Avery_Labels = array ( 'width'=>99.1, 'height'=>38.1, 'font-size'=>10), - 'AVERYC32010'=>array('name'=>'AVERY-C32010', + 'AVERYC32010'=>array('name'=>'AVERY-C32010 (A4)', 'paper-size'=>'A4', 'metric'=>'mm', 'marginLeft'=>15, @@ -126,7 +125,7 @@ $_Avery_Labels = array ( 'width'=>85, 'height'=>54, 'font-size'=>10), - 'CARD'=>array('name'=>'Dolibarr cards', + 'CARD'=>array('name'=>'Dolibarr Business cards (A4)', 'paper-size'=>'A4', 'metric'=>'mm', 'marginLeft'=>15, diff --git a/htdocs/core/modules/facture/modules_facture.php b/htdocs/core/modules/facture/modules_facture.php index 973a8461799..54fdeaef810 100644 --- a/htdocs/core/modules/facture/modules_facture.php +++ b/htdocs/core/modules/facture/modules_facture.php @@ -32,8 +32,7 @@ require_once(DOL_DOCUMENT_ROOT."/compta/bank/class/account.class.php"); // Req /** - * \class ModelePDFFactures - * \brief Classe mere des modeles de facture + * Parent class of invoice document generators */ abstract class ModelePDFFactures extends CommonDocGenerator { @@ -61,8 +60,7 @@ abstract class ModelePDFFactures extends CommonDocGenerator } /** - * \class ModeleNumRefFactures - * \brief Classe mere des modeles de numerotation des references de facture + * Classe mere des modeles de numerotation des references de facture */ abstract class ModeleNumRefFactures { diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php new file mode 100644 index 00000000000..2764dbfd868 --- /dev/null +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -0,0 +1,491 @@ + + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2006-2010 Laurent Destailleur + * Copyright (C) Steve Dillon + * Copyright (C) Laurent Passebecq + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* Inspire de PDF_Label + * PDF_Label - PDF label editing + * @package PDF_Label + * @author Laurent PASSEBECQ + * @copyright 2003 Laurent PASSEBECQ + * disponible ici : http://www.fpdf.org/fr/script/script29.php + */ + +//////////////////////////////////////////////////// +// PDF_Label +// +// Classe afin d'editer au format PDF des etiquettes +// au format Avery ou personnalise +// +// +// Copyright (C) 2003 Laurent PASSEBECQ (LPA) +// Base sur les fonctions de Steve Dillon : steved@mad.scientist.com +// +//------------------------------------------------------------------- +// 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 + */ + +require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'); + + +/** + * Classe afin d'editer au format PDF des cartes de visite au format Avery ou personnalise + */ +class pdf_standard +{ + + 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 + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + } + + + /** + * Methode qui permet de modifier la taille des caracteres + * Cela modiera aussi l'espace entre chaque ligne + */ + function Set_Char_Size(&$pdf,$pt) + { + if ($pt > 3) { + $this->_Char_Size = $pt; + $this->_Line_Height = $this->_Get_Height_Chars($pt); + $pdf->SetFont('','',$pt); + } + } + + + /** + * On imprime une etiquette + * + * @param PDF &$pdf PDF + */ + function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='',$idmember=0,$photomember='') + { + global $mysoc,$conf,$langs; + + // 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(); + } + $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; + } + } + + // Define photo + $dir=$conf->adherent->dir_output; + $file=get_exdir($idmember,2).'photos/'.$photomember; + $photo=$dir.'/'.$file; + if (empty($photomember) || ! is_readable($photo)) $photo=''; + + // Define background image + $backgroundimage=''; + if(! empty($conf->global->ADHERENT_CARD_BACKGROUND) && file_exists($conf->adherent->dir_output.'/'.$conf->global->ADHERENT_CARD_BACKGROUND)) + { + $backgroundimage=$conf->adherent->dir_output.'/'.$conf->global->ADHERENT_CARD_BACKGROUND; + } + + // Print lines + if ($this->code == "CARD") + { + $this->Tformat=$this->_Avery_Labels["CARD"]; + //$this->_Pointille($pdf,$_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,25); + $this->_Croix($pdf,$_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.1,10); + } + + // Background + if ($backgroundimage) + { + $pdf->image($backgroundimage,$_PosX,$_PosY,$this->_Width,$this->_Height); + } + + // Top + if ($header!='') + { + if ($this->code == "CARD") + { + $pdf->SetDrawColor(128,128,128); + $pdf->Line($_PosX, $_PosY+$this->_Line_Height+1, $_PosX+$this->_Width, $_PosY+$this->_Line_Height+1); + $pdf->SetDrawColor(0,0,0); + } + $pdf->SetXY($_PosX, $_PosY+1); + $pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($header),0,1,'C'); + } + + // Center + if ($textright=='') // Only a left part + { + if ($textleft == '%LOGO%' && $logo) $this->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + else if ($textleft == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + else + { + $pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height); + $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'); + } + 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'); + } + else + { + $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->MultiCell(round($this->_Width/2)-2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + } + + } + else // Only a right part + { + if ($textright == '%LOGO%' && $logo) $this->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); + else if ($textright == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); + else + { + $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); + $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + } + } + + // Bottom + if ($footer!='') + { + if ($this->code == "CARD") + { + $pdf->SetDrawColor(128,128,128); + $pdf->Line($_PosX, $_PosY+$this->_Height-$this->_Line_Height-2, $_PosX+$this->_Width, $_PosY+$this->_Height-$this->_Line_Height-2); + $pdf->SetDrawColor(0,0,0); + } + $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
\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; + } + } + + /** + * 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 + */ + 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 _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' + 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. + 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.. + } + } + + 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 $arrayofmembers Array of members informations + * @param Translate $outputlangs Lang object for output language + * @param string $srctemplatepath Full path of source filename for generator using a template file + * @return int 1=OK, 0=KO + */ + function write_file($arrayofmembers,$outputlangs,$srctemplatepath) + { + 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("members"); + $outputlangs->load("admin"); + + + $dir = (empty($outputdir)?$conf->adherent->dir_temp:$outputdir); + $filename='tmp_cards.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($outputlangs->transnoentities('MembersCards')); + $pdf->SetSubject($outputlangs->transnoentities("MembersCards")); + $pdf->SetCreator("Dolibarr ".DOL_VERSION); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetKeyWords($outputlangs->transnoentities('MembersCards')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name)); + if ($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($arrayofmembers as $val) + { + // imprime le texte specifique sur la carte + $this->Add_PDF_card($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['id'],$val['photo']); + } + + //$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; + } + +} +?> diff --git a/htdocs/core/modules/member/modules_cards.php b/htdocs/core/modules/member/modules_cards.php new file mode 100644 index 00000000000..705981e652f --- /dev/null +++ b/htdocs/core/modules/member/modules_cards.php @@ -0,0 +1,166 @@ + + * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2009 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \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'); +require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); + + +/** + * Parent class of document generator for members cards. + */ +class ModelePDFCards +{ + var $error=''; + + + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler + * @param string $maxfilenamelength Max length of value to show + * @return array List of templates + */ + function liste_modeles($db,$maxfilenamelength=0) + { + global $conf; + + $type='members_card'; + $liste=array(); + + include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'); + $liste=getListOfModels($db,$type,$maxfilenamelength); + + return $liste; + } +} + + +/** + * 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 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 + */ +function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs) +{ + global $conf,$langs; + $langs->load("members"); + + $error=0; + + // Increase limit for PDF build + $err=error_reporting(); + error_reporting(0); + @set_time_limit(120); + error_reporting($err); + + $code=''; + $srctemplatepath=''; + + // Positionne le modele sur le nom du modele a utiliser + if (! dol_strlen($modele)) + { + if (! empty($conf->global->ADHERENT_CARDS_ADDON_PDF)) + { + $code = $conf->global->ADHERENT_CARDS_ADDON_PDF; + } + else + { + $code = $modele; + } + } + else $code=$modele; + $modele='standard'; + + // If selected modele is a filename template (then $modele="modelname:filename") + $tmp=explode(':',$modele,2); + if (! empty($tmp[1])) + { + $modele=$tmp[0]; + $srctemplatepath=$tmp[1]; + } + else $srctemplatepath=$code; + + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array('/'); + if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + foreach(array('doc','pdf') as $prefix) + { + $file = $prefix."_".$modele.".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; + break; + } + } + if ($filefound) break; + } + + + // Charge le modele + if ($filefound) + { + require_once($file); + + $obj = new $classname($db); + + // 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; + if ($obj->write_file($arrayofmembers, $outputlangs, $srctemplatepath) > 0) + { + $outputlangs->charset_output=$sav_charset_output; + return 1; + } + else + { + $outputlangs->charset_output=$sav_charset_output; + dol_print_error($db,"members_card_pdf_create Error: ".$obj->error); + return -1; + } + } + + else + { + dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$dir.$file)); + return -1; + } + + +} + +?> \ No newline at end of file diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 2e7a874c914..9187502d6d1 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -75,26 +75,20 @@ class modAdherent extends DolibarrModules $this->const[4] = array("ADHERENT_MAIL_VALID","texte","Votre adhésion vient d'être validée. \r\nVoici le rappel de vos coordonnées (toute information erronée entrainera la non validation de votre inscription) :\r\n\r\n%INFOS%\r\n\r\n","Mail de validation"); $this->const[5] = array("ADHERENT_MAIL_VALID_SUBJECT","chaine","Votre adhésion a été validée","Sujet du mail de validation"); $this->const[6] = array("ADHERENT_MAIL_RESIL_SUBJECT","chaine","Résiliation de votre adhésion","Sujet du mail de résiliation"); - $this->const[10] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de désinscription aux listes mailman"); - $this->const[11] = array("ADHERENT_MAILMAN_URL","chaine","http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%","Url pour les inscriptions mailman"); - $this->const[12] = array("ADHERENT_MAILMAN_LISTS","chaine","","Mailing-list to subscribe new members to"); - $this->const[17] = array("ADHERENT_SPIP_USER","chaine","","Utilisateur de connexion à la base spip"); - $this->const[18] = array("ADHERENT_SPIP_PASS","chaine","","Mot de passe de connexion à la base spip"); - $this->const[19] = array("ADHERENT_SPIP_SERVEUR","chaine","","serveur spip"); - $this->const[20] = array("ADHERENT_SPIP_DB","chaine","","db spip"); $this->const[21] = array("ADHERENT_MAIL_FROM","chaine","","From des mails"); $this->const[22] = array("ADHERENT_MAIL_COTIS","texte","Bonjour %PRENOM%,\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[27] = array("ADHERENT_CARD_TEXT","texte","%PRENOM% %NOM%\r\nMembre ne %ID%\r\n%EMAIL%\r\n%ADRESSE%\r\n%CP% %VILLE%\r\n%PAYS%","Texte imprimé sur 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"); $this->const[32] = array("ADHERENT_BANK_ACCOUNT","chaine","","ID du Compte banquaire utilise"); $this->const[33] = array("ADHERENT_BANK_CATEGORIE","chaine","","ID de la catégorie banquaire des cotisations"); - $this->const[34] = array("ADHERENT_ETIQUETTE_TYPE","chaine","L7163","Type d'étiquette (pour impression de planche d'étiquettes)"); - - // Boites + $this->const[34] = array("ADHERENT_ETIQUETTE_TYPE","chaine","L7163","Type of address sheets"); + $this->const[35] = array("ADHERENT_ETIQUETTE_TEXT",'texte',"%FULLNAME%\n%ADDRESS%\n%ZIP% %TOWN%\n%COUNTRY%","Text to print on member address sheets"); + + // Boxes //------- $this->boxes = array(); $r=0; diff --git a/htdocs/core/modules/modMailmanSpip.class.php b/htdocs/core/modules/modMailmanSpip.class.php index 34ef90f5a2e..71f202805b9 100644 --- a/htdocs/core/modules/modMailmanSpip.class.php +++ b/htdocs/core/modules/modMailmanSpip.class.php @@ -17,10 +17,10 @@ */ /** - * \defgroup clicktodial Module clicktodial - * \brief Module pour gerer l'appel automatique - * \file htdocs/core/modules/modClickToDial.class.php - * \ingroup clicktodial + * \defgroup mailmanspip Module mailmanspip + * \brief Module to manage mailman and spip + * \file htdocs/core/modules/modMailmanSpip.class.php + * \ingroup mailmanspip * \brief Fichier de description et activation du module de click to Dial */ @@ -28,10 +28,8 @@ include_once(DOL_DOCUMENT_ROOT ."/core/modules/DolibarrModules.class.php"); /** - * \class modMailmanSpip - * \brief Classe de description et activation du module de Click to Dial + * Classe de description et activation du module de Click to Dial */ - class modMailmanSpip extends DolibarrModules { @@ -68,7 +66,10 @@ class modMailmanSpip extends DolibarrModules // Constants $this->const = array(); - + $this->const[1] = array("ADHERENT_MAILMAN_UNSUB_URL","chaine","http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&user=%EMAIL%","Url de désinscription aux listes mailman"); + $this->const[2] = array("ADHERENT_MAILMAN_URL","chaine","http://lists.domain.com/cgi-bin/mailman/admin/%LISTE%/members?adminpw=%MAILMAN_ADMINPW%&send_welcome_msg_to_this_batch=1&subscribees=%EMAIL%","Url pour les inscriptions mailman"); + $this->const[3] = array("ADHERENT_MAILMAN_LISTS","chaine","","Mailing-list to subscribe new members to"); + // Boxes $this->boxes = array(); diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php new file mode 100644 index 00000000000..c0a2934ccfc --- /dev/null +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -0,0 +1,480 @@ + + * Copyright (C) 2002-2003 Jean-Louis Bergamo + * Copyright (C) 2006-2010 Laurent Destailleur + * Copyright (C) Steve Dillon + * Copyright (C) Laurent Passebecq + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* Inspire de PDF_Label + * PDF_Label - PDF label editing + * @package PDF_Label + * @author Laurent PASSEBECQ + * @copyright 2003 Laurent PASSEBECQ + * disponible ici : http://www.fpdf.org/fr/script/script29.php + */ + +//////////////////////////////////////////////////// +// PDF_Label +// +// Classe afin d'editer au format PDF des etiquettes +// au format Avery ou personnalise +// +// +// Copyright (C) 2003 Laurent PASSEBECQ (LPA) +// Base sur les fonctions de Steve Dillon : steved@mad.scientist.com +// +//------------------------------------------------------------------- +// 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 + */ + +require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'); + + +/** + * Classe afin d'editer au format PDF des pages d'etiquette adresse au format Avery ou personnalise + */ +class pdf_standardlabel +{ + + 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 + * + * @param DoliDB $db Database handler + */ + function __construct($db) + { + $this->db = $db; + } + + /** + * Methode qui permet de modifier la taille des caracteres + * Cela modiera aussi l'espace entre chaque ligne + */ + function Set_Char_Size(&$pdf,$pt) + { + if ($pt > 3) { + $this->_Char_Size = $pt; + $this->_Line_Height = $this->_Get_Height_Chars($pt); + $pdf->SetFont('','',$pt); + } + } + + /** + * On imprime une etiquette + * + * @param PDF &$pdf PDF + */ + function Add_PDF_card(&$pdf,$textleft,$header,$footer,$outputlangs,$textright='') + { + global $mysoc,$conf,$langs; + + // 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(); + } + $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; + } + } + // Define photo + $photo=''; + + // Define background image + $backgroundimage=''; + + // Print lines + if ($this->code == "CARD") + { + $this->Tformat=$this->_Avery_Labels["CARD"]; + //$this->_Pointille($pdf,$_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.3,25); + $this->_Croix($pdf,$_PosX,$_PosY,$_PosX+$this->_Width,$_PosY+$this->_Height,0.1,10); + } + + // Background + if ($backgroundimage) + { + $pdf->image($backgroundimage,$_PosX,$_PosY,$this->_Width,$this->_Height); + } + + // Top + if ($header!='') + { + if ($this->code == "CARD") + { + $pdf->SetDrawColor(128,128,128); + $pdf->Line($_PosX, $_PosY+$this->_Line_Height+1, $_PosX+$this->_Width, $_PosY+$this->_Line_Height+1); + $pdf->SetDrawColor(0,0,0); + } + $pdf->SetXY($_PosX, $_PosY+1); + $pdf->Cell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($header),0,1,'C'); + } + + // Middle + if ($textright=='') // Only a left part + { + if ($textleft == '%LOGO%' && $logo) $this->Image($logo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + else if ($textleft == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+2,$_PosY+3+$this->_Line_Height,20); + else + { + $pdf->SetXY($_PosX+3, $_PosY+3+$this->_Line_Height); + $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'); + } + 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'); + } + else + { + $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->MultiCell(round($this->_Width/2)-2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + } + } + else // Only a right part + { + if ($textright == '%LOGO%' && $logo) $this->Image($logo,$_PosX+$this->_Width-21,$_PosY+1,20); + else if ($textright == '%PHOTO%' && $photo) $this->Image($photo,$_PosX+$this->_Width-21,$_PosY+1,20); + else + { + $pdf->SetXY($_PosX+2, $_PosY+3+$this->_Line_Height); + $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textright),0,'R'); + } + } + + // Bottom + if ($footer!='') + { + if ($this->code == "CARD") + { + $pdf->SetDrawColor(128,128,128); + $pdf->Line($_PosX, $_PosY+$this->_Height-$this->_Line_Height-2, $_PosX+$this->_Width, $_PosY+$this->_Height-$this->_Line_Height-2); + $pdf->SetDrawColor(0,0,0); + } + $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
\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; + } + } + + + /** + * 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 + */ + 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 _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' + 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. + 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.. + } + } + + 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 $arrayofmembers Array of members informations + * @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 + * @return int 1=OK, 0=KO + */ + function write_file($arrayofmembers,$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("members"); + $outputlangs->load("admin"); + + $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($outputlangs->transnoentities('MembersLabels')); + $pdf->SetSubject($outputlangs->transnoentities("MembersLabels")); + $pdf->SetCreator("Dolibarr ".DOL_VERSION); + $pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs))); + $pdf->SetKeyWords($outputlangs->transnoentities('MembersLabels')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name)); + if ($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($arrayofmembers as $val) + { + // imprime le texte specifique sur la carte + $this->Add_PDF_card($pdf,$val['textleft'],$val['textheader'],$val['textfooter'],$langs,$val['textright'],$val['id'],$val['photo']); + } + + //$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; + } +} +?> diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php new file mode 100644 index 00000000000..cf770e6677c --- /dev/null +++ b/htdocs/core/modules/printsheet/modules_labels.php @@ -0,0 +1,165 @@ + + * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2004 Eric Seigne + * Copyright (C) 2005-2009 Regis Houssin + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * or see http://www.gnu.org/ + */ + +/** + * \file htdocs/core/modules/printsheet/modules_labels.php + * \ingroup member + * \brief File of parent class of document generator for members labels sheets. + */ + +require_once(DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'); +require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); + + +/** + * Parent class of document generator for address sheet. + */ +class ModelePDFLabels +{ + var $error=''; + + + /** + * Return list of active generation modules + * + * @param DoliDB $db Database handler + * @param string $maxfilenamelength Max length of value to show + * @return array List of templates + */ + function liste_modeles($db,$maxfilenamelength=0) + { + global $conf; + + $type='members_labels'; + $liste=array(); + + include_once(DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'); + $liste=getListOfModels($db,$type,$maxfilenamelength); + + return $liste; + } +} + + +/** + * Create a document onto disk accordign to template module + * + * @param DoliDB $db Database handler + * @param array $arrayofmembers Array of members + * @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 + * @return int <0 if KO, >0 if OK + */ +function members_label_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $outputdir='') +{ + global $conf,$langs; + $langs->load("members"); + + $error=0; + + // Increase limit for PDF build + $err=error_reporting(); + error_reporting(0); + @set_time_limit(120); + error_reporting($err); + + $code=''; + $srctemplatepath=''; + + // Positionne le modele sur le nom du modele a utiliser + if (! dol_strlen($modele)) + { + if (! empty($conf->global->ADHERENT_ETIQUETTE_TYPE)) + { + $code = $conf->global->ADHERENT_ETIQUETTE_TYPE; + } + else + { + $code = $modele; + } + } + else $code=$modele; + $modele='standardlabel'; + + // If selected modele is a filename template (then $modele="modelname:filename") + $tmp=explode(':',$modele,2); + if (! empty($tmp[1])) + { + $modele=$tmp[0]; + $srctemplatepath=$tmp[1]; + } + else $srctemplatepath=$code; + + // Search template files + $file=''; $classname=''; $filefound=0; + $dirmodels=array('/'); + if (is_array($conf->modules_parts['models'])) $dirmodels=array_merge($dirmodels,$conf->modules_parts['models']); + foreach($dirmodels as $reldir) + { + foreach(array('doc','pdf') as $prefix) + { + $file = $prefix."_".$modele.".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; + break; + } + } + if ($filefound) break; + } + + // Charge le modele + if ($filefound) + { + require_once($file); + + $obj = new $classname($db); + + // 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; + if ($obj->write_file($arrayofmembers, $outputlangs, $srctemplatepath, $outputdir) > 0) + { + $outputlangs->charset_output=$sav_charset_output; + return 1; + } + else + { + $outputlangs->charset_output=$sav_charset_output; + dol_print_error($db,"members_label_pdf_create Error: ".$obj->error); + return -1; + } + } + else + { + dol_print_error('',$langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists",$file)); + return -1; + } + + +} + +?> \ No newline at end of file diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index 6b503110a0b..f44a349884e 100755 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Xavier Dutoit - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin @@ -29,7 +29,7 @@ * \brief File that include conf.php file and commons lib like functions.lib.php */ -if (! defined('DOL_VERSION')) define('DOL_VERSION','3.3.0-alpha'); // Also defined in htdocs/install/inc.php (Ex: x.y.z-alpha, x.y.z) +if (! defined('DOL_VERSION')) define('DOL_VERSION','3.3.0-alpha'); if (! defined('EURO')) define('EURO',chr(128)); // Define syslog constants @@ -53,10 +53,13 @@ if (! defined('LOG_DEBUG')) } } -// Forcage du parametrage PHP error_reporting (Dolibarr non utilisable en mode error E_ALL) -error_reporting(E_ALL ^ E_NOTICE); +// Force PHP error_reporting setup (Dolibarr may report warning without this) +error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT); //error_reporting(E_ALL | E_STRICT); +// End of common declaration part +if (defined('DOL_INC_FOR_VERSION_ERROR')) return; + // Define vars $conffiletoshowshort = "conf.php"; @@ -77,10 +80,7 @@ if (! $result && ! empty($_SERVER["GATEWAY_INTERFACE"])) // If install not do } // Disable php display errors -if (! empty($dolibarr_main_prod)) -{ - ini_set('display_errors','Off'); -} +if (! empty($dolibarr_main_prod)) ini_set('display_errors','Off'); // Clean parameters $dolibarr_main_data_root=trim($dolibarr_main_data_root); diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 5e328dd3b37..01bef563c4c 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Sebastien DiCintio - * Copyright (C) 2007-2011 Laurent Destailleur + * Copyright (C) 2007-2012 Laurent Destailleur * * 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 @@ -24,9 +24,11 @@ * \brief File that define environment for support pages */ -define('DOL_VERSION','3.3.0-alpha'); // Also defined in htdocs/master.inc.php (Ex: x.y.z-alpha, x.y.z) +// Just to define version DOL_VERSION +if (! defined('DOL_INC_FOR_VERSION_ERROR')) define('DOL_INC_FOR_VERSION_ERROR','1'); +require_once('../filefunc.inc.php'); -// Define DOL_DOCUMENT_ROOT an ADODB_PATH used for install/upgrade process +// Define DOL_DOCUMENT_ROOT and ADODB_PATH used for install/upgrade process if (! defined('DOL_DOCUMENT_ROOT')) define('DOL_DOCUMENT_ROOT', '..'); if (! defined('ADODB_PATH')) { @@ -35,22 +37,20 @@ if (! defined('ADODB_PATH')) define('ADODB_PATH', $foundpath); } -require_once('../core/class/translate.class.php'); -require_once('../core/lib/functions.lib.php'); -require_once('../core/lib/admin.lib.php'); -require_once('../core/lib/files.lib.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); require_once(ADODB_PATH.'adodb-time.inc.php'); -error_reporting(E_ALL); // To have all errors without disabled E_STRICT - -// IMPORTANT with strict mode E_STRICT +// Avoid warnings with strict mode E_STRICT $conf = new stdClass(); // instantiate $conf explicitely $conf->global = (object) array(); $conf->file = (object) array(); $conf->db = (object) array(); $conf->syslog = (object) array(); -// Define $_REQUEST["logtohtml"] +// Force $_REQUEST["logtohtml"] $_REQUEST["logtohtml"]=1; // Correction PHP_SELF (ex pour apache via caudium) car PHP_SELF doit valoir URL relative @@ -61,27 +61,6 @@ if (isset($_SERVER["DOCUMENT_URI"]) && $_SERVER["DOCUMENT_URI"]) } -// Define syslog constants -if (! defined('LOG_DEBUG')) -{ - if (function_exists("define_syslog_variables")) - { - define_syslog_variables(); // Deprecated since php 5.3.0, syslog variables no longer need to be initialized - } - else - { - // Pour PHP sans syslog (comme sous Windows) - define('LOG_EMERG',0); - define('LOG_ALERT',1); - define('LOG_CRIT',2); - define('LOG_ERR',3); - define('LOG_WARNING',4); - define('LOG_NOTICE',5); - define('LOG_INFO',6); - define('LOG_DEBUG',7); - } -} - $includeconferror=''; @@ -100,7 +79,9 @@ if (! defined('DONOTLOADCONF') && file_exists($conffile)) $result=include_once($conffile); // Load conf file if ($result) { - // Clean parameters + if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // For backward compatibility + + // Clean parameters $dolibarr_main_data_root =isset($dolibarr_main_data_root)?trim($dolibarr_main_data_root):''; $dolibarr_main_url_root =isset($dolibarr_main_url_root)?trim($dolibarr_main_url_root):''; $dolibarr_main_url_root_alt =isset($dolibarr_main_url_root_alt)?trim($dolibarr_main_url_root_alt):''; @@ -251,7 +232,8 @@ if (function_exists('get_magic_quotes_gpc')) // magic_quotes_* removed in PHP 5. // Defini objet langs $langs = new Translate('..',$conf); -$langs->setDefaultLang('auto'); +if (GETPOST('lang')) $langs->setDefaultLang(GETPOST('lang')); +else $langs->setDefaultLang('auto'); $bc[false]=' class="bg1"'; $bc[true]=' class="bg2"'; @@ -316,9 +298,9 @@ function conf($dolibarr_main_document_root) /** - * Show header of install pages + * Show HTML header of install pages * - * @param string $soutitre Sous titre + * @param string $soutitre Title * @param string $next Next * @param string $action Action code ('set' or 'upgrade') * @param string $param Param @@ -338,7 +320,7 @@ function pHeader($soutitre,$next,$action='set',$param='') print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; + print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; @@ -361,10 +343,10 @@ function pHeader($soutitre,$next,$action='set',$param='') } /** - * Output footer of install pages + * Print HTML footer of install pages * - * @param string $nonext No next - * @param string $setuplang Setup lang + * @param string $nonext No button "Next step" + * @param string $setuplang Language code * @param string $jscheckfunction Add a javascript check function * @return void */ diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index cfaba733759..232441f6a26 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -141,6 +141,7 @@ DescADHERENT_MAIL_RESIL_SUBJECT=EMail subject for member resiliation DescADHERENT_MAIL_RESIL=EMail for member resiliation DescADHERENT_MAIL_FROM=Sender EMail for automatic emails DescADHERENT_ETIQUETTE_TYPE=Format of labels page +DescADHERENT_ETIQUETTE_TEXT=Text printed on member address sheets DescADHERENT_CARD_TYPE=Format of cards page DescADHERENT_CARD_HEADER_TEXT=Text printed on top of member cards DescADHERENT_CARD_TEXT=Text printed on member cards (align on left) @@ -160,9 +161,9 @@ MoreActionBankViaInvoice=Create an invoice and payment on account MoreActionInvoiceOnly=Create an invoice with no payment LinkToGeneratedPages=Generate visit cards LinkToGeneratedPagesDesc=This screen allows you to generate PDF files with business cards for all your members or a particular member. -DocForAllMembersCards=Generate business cards for all members (Format for output actually setup : %s) -DocForOneMemberCards=Generate business cards for a particular member (Format for output actually setup: %s) -DocForLabels=Generate address sheets (Format for output actually setup: %s) +DocForAllMembersCards=Generate business cards for all members +DocForOneMemberCards=Generate business cards for a particular member +DocForLabels=Generate address sheets SubscriptionPayment=Subscription payment LastSubscriptionDate=Last subscription date LastSubscriptionAmount=Last subscription amount diff --git a/htdocs/langs/es_ES/members.lang b/htdocs/langs/es_ES/members.lang index fac0c82d0c5..4ccee8d5918 100644 --- a/htdocs/langs/es_ES/members.lang +++ b/htdocs/langs/es_ES/members.lang @@ -163,9 +163,9 @@ MoreActionBankViaInvoice=Creación factura con el pago en cuenta bancaria o caja MoreActionInvoiceOnly=Creación factura sin pago LinkToGeneratedPages=Generación de tarjetas de presentación LinkToGeneratedPagesDesc=Esta pantalla le permite crear plantillas de tarjetas de presentación para los miembros o para cada miembro en particular. -DocForAllMembersCards=Generación de tarjetas para todos los miembros (Formato de plantilla configurado actualmente: %s) -DocForOneMemberCards=Generación de tarjetas para un miembro en particular (Formato de plantilla configurado actualmente: %s) -DocForLabels=Generación de etiquetas de direcciones (Formato de plantilla configurado actualmente: %s) +DocForAllMembersCards=Generación de tarjetas para todos los miembros +DocForOneMemberCards=Generación de tarjetas para un miembro en particular +DocForLabels=Generación de etiquetas de direcciones SubscriptionPayment=Pago cuota LastSubscriptionDate=Fecha de la última cotización LastSubscriptionAmount=Importe de la última cotización diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang index b89e294a037..c309f2d5c96 100644 --- a/htdocs/langs/fr_FR/members.lang +++ b/htdocs/langs/fr_FR/members.lang @@ -145,6 +145,7 @@ DescADHERENT_MAIL_RESIL_SUBJECT=Sujet du mail de résiliation DescADHERENT_MAIL_RESIL=Mail de résiliation DescADHERENT_MAIL_FROM=Mail émetteur pour les mails automatiques DescADHERENT_ETIQUETTE_TYPE=Format pages étiquettes +DescADHERENT_ETIQUETTE_TEXT=Texte imprimé sur les planches d'adresses adhérent DescADHERENT_CARD_TYPE=Format pages cartes d'adhérent DescADHERENT_CARD_HEADER_TEXT=Texte imprimé sur le haut des cartes d'adhérent DescADHERENT_CARD_TEXT=Texte imprimé sur les cartes d'adhérent (Aligné à gauche) @@ -162,11 +163,11 @@ MoreActions=Action complémentaire à l'enregistrement MoreActionBankDirect=Création transaction sur compte bancaire ou caisse directement MoreActionBankViaInvoice=Création facture avec paiement sur compte bancaire ou caisse MoreActionInvoiceOnly=Création facture sans paiement -LinkToGeneratedPages=Génération de cartes de visites -LinkToGeneratedPagesDesc=Cet écran vous permet de générer des planches de cartes de visite pour chaque adhérent ou pour un adhérent en particulier. -DocForAllMembersCards=Génération de cartes pour tous les adhérents (Format de planche actuellement configuré: %s) -DocForOneMemberCards=Génération de cartes pour un adhérent particulier (Format de planche actuellement configuré: %s) -DocForLabels=Génération d'étiquettes d'adresses (Format de planche actuellement configuré: %s) +LinkToGeneratedPages=Génération de cartes de visites ou planches d'adresses +LinkToGeneratedPagesDesc=Cet écran vous permet de générer des planches de cartes de visite ou d'étiquettes d'adresses pour chaque adhérent ou pour un adhérent en particulier. +DocForAllMembersCards=Génération de cartes pour tous les adhérents +DocForOneMemberCards=Génération de cartes pour un adhérent particulier +DocForLabels=Génération d'étiquettes d'adresses SubscriptionPayment=Paiement cotisation LastSubscriptionDate=Date de la dernière cotisation LastSubscriptionAmount=Montant de la dernière cotisation diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 318161f5454..174d0357ab2 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -233,6 +233,8 @@ if (! defined('NOREQUIREDB') && ! defined('NOREQUIRESOC')) $mysoc->idprof2=empty($conf->global->MAIN_INFO_SIRET)?'':$conf->global->MAIN_INFO_SIRET; $mysoc->idprof3=empty($conf->global->MAIN_INFO_APE)?'':$conf->global->MAIN_INFO_APE; $mysoc->idprof4=empty($conf->global->MAIN_INFO_RCS)?'':$conf->global->MAIN_INFO_RCS; + $mysoc->idprof5=empty($conf->global->MAIN_INFO_PROFID5)?'':$conf->global->MAIN_INFO_PROFID5; + $mysoc->idprof6=empty($conf->global->MAIN_INFO_PROFID6)?'':$conf->global->MAIN_INFO_PROFID6; $mysoc->tva_intra=$conf->global->MAIN_INFO_TVAINTRA; // VAT number, not necessarly INTRA. $mysoc->idtrainer=empty($conf->global->MAIN_INFO_TRAINER)?'':$conf->global->MAIN_INFO_TRAINER; $mysoc->capital=$conf->global->MAIN_INFO_CAPITAL; diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index e2d3935a23c..00222ad17df 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004 Rodolphe Quiedeville * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2004 Sebastien DiCintio - * Copyright (C) 2007-2011 Laurent Destailleur + * Copyright (C) 2007-2012 Laurent Destailleur * * 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 @@ -24,9 +24,11 @@ * \brief File that define environment for support pages */ -define('DOL_VERSION','3.3.0-alpha'); // Also defined in htdocs/master.inc.php +// Just to define version DOL_VERSION +if (! defined('DOL_INC_FOR_VERSION_ERROR')) define('DOL_INC_FOR_VERSION_ERROR','1'); +require_once('../filefunc.inc.php'); -// Define DOL_DOCUMENT_ROOT an ADODB_PATH used for install/upgrade process +// Define DOL_DOCUMENT_ROOT and ADODB_PATH used for install/upgrade process if (! defined('DOL_DOCUMENT_ROOT')) define('DOL_DOCUMENT_ROOT', '..'); if (! defined('ADODB_PATH')) { @@ -35,12 +37,21 @@ if (! defined('ADODB_PATH')) define('ADODB_PATH', $foundpath); } -require_once('../core/class/translate.class.php'); -require_once('../core/lib/functions.lib.php'); -require_once('../core/lib/admin.lib.php'); -require_once('../core/lib/files.lib.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'); +require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'); require_once(ADODB_PATH.'adodb-time.inc.php'); +// Avoid warnings with strict mode E_STRICT +$conf = new stdClass(); // instantiate $conf explicitely +$conf->global = (object) array(); +$conf->file = (object) array(); +$conf->db = (object) array(); +$conf->syslog = (object) array(); + +// Force $_REQUEST["logtohtml"] +$_REQUEST["logtohtml"]=1; // Correction PHP_SELF (ex pour apache via caudium) car PHP_SELF doit valoir URL relative // et non path absolu. @@ -61,19 +72,28 @@ $conffiletoshow = "htdocs/conf/conf.php"; //$conffile = "/etc/dolibarr/conf.php"; //$conffiletoshow = "/etc/dolibarr/conf.php"; -$charset="UTF-8"; // If not output format found in any conf file if (! defined('DONOTLOADCONF') && file_exists($conffile)) { $result=include_once($conffile); // Load conf file if ($result) { + if (empty($dolibarr_main_db_type)) $dolibarr_main_db_type='mysql'; // For backward compatibility + + // Clean parameters + $dolibarr_main_data_root =isset($dolibarr_main_data_root)?trim($dolibarr_main_data_root):''; + $dolibarr_main_url_root =isset($dolibarr_main_url_root)?trim($dolibarr_main_url_root):''; + $dolibarr_main_url_root_alt =isset($dolibarr_main_url_root_alt)?trim($dolibarr_main_url_root_alt):''; + $dolibarr_main_document_root =isset($dolibarr_main_document_root)?trim($dolibarr_main_document_root):''; + $dolibarr_main_document_root_alt=isset($dolibarr_main_document_root_alt)?trim($dolibarr_main_document_root_alt):''; // Remove last / or \ on directories or url value if (! empty($dolibarr_main_document_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_document_root)) $dolibarr_main_document_root=preg_replace('/[\\/]+$/','',$dolibarr_main_document_root); if (! empty($dolibarr_main_url_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_url_root)) $dolibarr_main_url_root=preg_replace('/[\\/]+$/','',$dolibarr_main_url_root); if (! empty($dolibarr_main_data_root) && ! preg_match('/^[\\/]+$/',$dolibarr_main_data_root)) $dolibarr_main_data_root=preg_replace('/[\\/]+$/','',$dolibarr_main_data_root); - + if (! empty($dolibarr_main_document_root_alt) && ! preg_match('/^[\\/]+$/',$dolibarr_main_document_root_alt)) $dolibarr_main_document_root_alt=preg_replace('/[\\/]+$/','',$dolibarr_main_document_root_alt); + if (! empty($dolibarr_main_url_root_alt) && ! preg_match('/^[\\/]+$/',$dolibarr_main_url_root_alt)) $dolibarr_main_url_root_alt=preg_replace('/[\\/]+$/','',$dolibarr_main_url_root_alt); + // Create conf object if (! empty($dolibarr_main_document_root)) { @@ -101,16 +121,30 @@ if (! defined('DONOTLOADCONF') && file_exists($conffile)) $includeconferror='ErrorBadFormatForConfFile'; } } +$conf->global->MAIN_LOGTOHTML = 1; // Define prefix if (! isset($dolibarr_main_db_prefix) || ! $dolibarr_main_db_prefix) $dolibarr_main_db_prefix='llx_'; define('MAIN_DB_PREFIX',(isset($dolibarr_main_db_prefix)?$dolibarr_main_db_prefix:'')); +define('DOL_CLASS_PATH', 'class/'); // Filsystem path to class dir define('DOL_DATA_ROOT',(isset($dolibarr_main_data_root)?$dolibarr_main_data_root:'')); -if (empty($conf->file->character_set_client)) $conf->file->character_set_client=$charset; -if (empty($conf->db->dolibarr_main_db_collation)) $conf->db->dolibarr_main_db_collation='latin1_swedish_ci'; -if (empty($conf->db->dolibarr_main_db_encryption)) $conf->db->dolibarr_main_db_encryption=0; -if (empty($conf->db->dolibarr_main_db_cryptkey)) $conf->db->dolibarr_main_db_cryptkey=''; +if (! empty($dolibarr_main_document_root_alt)) +{ + define('DOL_DOCUMENT_ROOT_ALT', $dolibarr_main_document_root_alt); // Filesystem paths to alternate core php (alternate htdocs) +} +define('DOL_MAIN_URL_ROOT', (isset($dolibarr_main_url_root)?$dolibarr_main_url_root:'')); // URL relative root +$uri=preg_replace('/^http(s?):\/\//i','',constant('DOL_MAIN_URL_ROOT')); // $uri contains url without http* +$suburi = strstr($uri, '/'); // $suburi contains url without domain +if ($suburi == '/') $suburi = ''; // If $suburi is /, it is now '' +define('DOL_URL_ROOT', $suburi); // URL relative root ('', '/dolibarr', ...) + + +if (empty($conf->file->character_set_client)) $conf->file->character_set_client="UTF-8"; +if (empty($conf->db->character_set)) $conf->db->character_set='utf8'; +if (empty($conf->db->dolibarr_main_db_collation)) $conf->db->dolibarr_main_db_collation='utf8_general_ci'; +if (empty($conf->db->dolibarr_main_db_encryption)) $conf->db->dolibarr_main_db_encryption=0; +if (empty($conf->db->dolibarr_main_db_cryptkey)) $conf->db->dolibarr_main_db_cryptkey=''; if (empty($conf->db->user)) $conf->db->user=''; @@ -158,12 +192,12 @@ function conf($dolibarr_main_document_root) /** - * Show HTML header + * Show HTML header * - * @param string $soutitre Title - * @param string $next Next - * @param string $action Action - * @return void + * @param string $soutitre Title + * @param string $next Next + * @param string $action Action code + * @return void */ function pHeader($soutitre,$next,$action='none') { @@ -198,7 +232,7 @@ function pHeader($soutitre,$next,$action='none') } /** - * Show footer + * Print HTML footer * * @param string $nonext No button "Next step" * @param string $setuplang Language code diff --git a/htdocs/support/index.php b/htdocs/support/index.php index dcfeb73c70f..ffc4ee4db15 100644 --- a/htdocs/support/index.php +++ b/htdocs/support/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2008-2012 Laurent Destailleur * * 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 @@ -21,7 +21,6 @@ * \brief Provide an Online Help support */ -error_reporting(0); // Use its own include to not share the include of Dolibarr // This is a standalone feature with no information from Dolibarr to show @@ -40,7 +39,7 @@ $langs->load("help"); * View */ -pHeader($langs->trans("DolibarrHelpCenter"),$_SERVER["PHP_SELF"]); +pHeader($langs->trans("DolibarrHelpCenter").' '.DOL_VERSION, $_SERVER["PHP_SELF"]); print $langs->trans("HelpCenterDesc1")."
\n"; print $langs->trans("HelpCenterDesc2")."
\n"; diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index e0d82a22852..118b62fc453 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -105,7 +105,7 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) { $conf->global->THEME_ELDY_TOPMENU_BACK1='180,196,216'; // topmenu $conf->global->THEME_ELDY_TOPMENU_BACK2='190,206,226'; - $conf->global->THEME_ELDY_VERMENU_BACK1='246,248,250'; // vmenu + $conf->global->THEME_ELDY_VERMENU_BACK1='246,248,250'; // vmenu $conf->global->THEME_ELDY_VERMENU_BACK1b='226,228,230'; // vmenu (not menu) $conf->global->THEME_ELDY_VERMENU_BACK2='220,224,227'; $conf->global->THEME_ELDY_BACKTITLE1='140,160,185'; // title of arrays @@ -196,6 +196,17 @@ input, input.flat, textarea, textarea.flat, form.flat select, select.flat { padding: 1px 1px 1px 1px; margin: 0px 0px 0px 0px; } +input, textarea, select { + border-radius:4px; + border:solid 1px rgba(0,0,0,.3); + border-top:solid 1px rgba(0,0,0,.3); + border-bottom:solid 1px rgba(0,0,0,.2); + box-shadow: 1px 1px 2px rgba(0,0,0,.2) inset; + padding:2px; + margin-left:1px; + margin-bottom:1px; + margin-top:1px; + } select.flat, form.flat select { font-weight: normal; } @@ -737,7 +748,7 @@ a.vsmenu:link, a.vsmenu:visited { color: #; } a.help:link, a.help:visited, a.help:hover, a.help:active { font-size:px; font-family: ; text-align: ; font-weight: normal; color: #666666; } -div.blockvmenupair, div.blockvmenuimpair +div.blockvmenupair, div.blockvmenuimpair, div.blockvmenubookmarks { width:174px; font-family: ; @@ -804,7 +815,7 @@ div.blockvmenusearch box-shadow: 4px 4px 4px #CCC; } -div.blockvmenubookmarks +div.blockvmenubookmarksold { width:174px; border-right: 1px solid #555555;