From 337897e0a131b21e6bbb36afbb9842f3a646036f Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 23 Dec 2016 15:01:49 +0100 Subject: [PATCH 01/11] NEW : Allow extrafields list select to be dependands on other standard list and not only other extrafields list --- htdocs/core/class/commonobject.class.php | 36 ++++++++++++------------ htdocs/langs/en_US/admin.lang | 6 ++-- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5e83f59ea36..7e59685b4b3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -597,11 +597,11 @@ abstract class CommonObject dol_syslog("CODE_NOT_VALID_FOR_THIS_ELEMENT"); return -3; } - + $datecreate = dol_now(); $this->db->begin(); - + // Insertion dans la base $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact"; $sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) "; @@ -1230,19 +1230,19 @@ abstract class CommonObject function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $user='', $trigkey='') { global $user,$langs,$conf; - + if (empty($table)) $table=$this->table_element; if (empty($id)) $id=$this->id; if (empty($format)) $format='text'; if (empty($id_field)) $id_field='rowid'; $error=0; - + $this->db->begin(); // Special case if ($table == 'product' && $field == 'note_private') $field='note'; - + $sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET "; if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'"; else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value); @@ -1517,7 +1517,7 @@ abstract class CommonObject if($mode == 1) { $line->subprice = 0; } - + switch ($this->element) { case 'propal': $this->updateline($line->id, $line->subprice, $line->qty, $line->remise_percent, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, $line->desc, 'HT', $line->info_bits, $line->special_code, $line->fk_parent_line, $line->skip_update_total, $line->fk_fournprice, $line->pa_ht, $line->label, $line->product_type, $line->date_start, $line->date_end, $line->array_options, $line->fk_unit, $line->multicurrency_subprice); @@ -2153,7 +2153,7 @@ abstract class CommonObject // Special cas //var_dump($this->table_element);exit; if ($this->table_element == 'product') $suffix=''; - + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL"); $sql.= " WHERE rowid =". $this->id; @@ -2163,7 +2163,7 @@ abstract class CommonObject { if ($suffix == '_public') $this->note_public = $note; else if ($suffix == '_private') $this->note_private = $note; - else + else { $this->note = $note; // deprecated $this->note_private = $note; @@ -2412,7 +2412,7 @@ abstract class CommonObject // Special case if ($origin == 'order') $origin='commande'; if ($origin == 'invoice') $origin='facture'; - + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; @@ -2899,7 +2899,7 @@ abstract class CommonObject function isObjectUsed($id=0) { if (empty($id)) $id=$this->id; - + // Check parameters if (! isset($this->childtables) || ! is_array($this->childtables) || count($this->childtables) == 0) { @@ -3341,9 +3341,9 @@ abstract class CommonObject if ($conf->global->MARGIN_TYPE == "1") print ''.$langs->trans('BuyingPrice').''; else - print ''.$langs->trans('CostPrice').''; + print ''.$langs->trans('CostPrice').''; } - + if (! empty($conf->global->DISPLAY_MARGIN_RATES) && $user->rights->margins->liretous) print ''.$langs->trans('MarginRate').''; if (! empty($conf->global->DISPLAY_MARK_RATES) && $user->rights->margins->liretous) @@ -3875,7 +3875,7 @@ abstract class CommonObject if ($filefound) { global $db; // Required to solve a conception default in commonstickergenerator.class.php making an include of code using $db - + require_once $file; $obj = new $classname($this->db); @@ -3934,7 +3934,7 @@ abstract class CommonObject // output format that does not support UTF8. $sav_charset_output=$outputlangs->charset_output; - if (in_array(get_class($this), array('Adherent'))) + if (in_array(get_class($this), array('Adherent'))) { $arrayofrecords = array(); // The write_file of templates of adherent class need this $resultwritefile = $obj->write_file($this, $outputlangs, $srctemplatepath, 'member', 1, $moreparams); @@ -4195,7 +4195,7 @@ abstract class CommonObject require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; $extrafields = new ExtraFields($this->db); $target_extrafields=$extrafields->fetch_name_optionals_label($this->table_element); - + //Eliminate copied source object extra_fields that do not exist in target object $new_array_options=array(); foreach ($this->array_options as $key => $value) { @@ -4244,7 +4244,7 @@ abstract class CommonObject { if (is_numeric($value)) $res=$object->fetch($value); else $res=$object->fetch('',$value); - + if ($res > 0) $this->array_options[$key]=$object->id; else { @@ -4503,7 +4503,7 @@ abstract class CommonObject jQuery(document).ready(function() { function showOptions(child_list, parent_list) { - var val = $("select[name=\"options_"+parent_list+"\"]").val(); + var val = $("select[name="+parent_list+"]").val(); var parentVal = parent_list + ":" + val; if(val > 0) { $("select[name=\""+child_list+"\"] option[parent]").hide(); @@ -4518,7 +4518,7 @@ abstract class CommonObject var parent = $(this).find("option[parent]:first").attr("parent"); var infos = parent.split(":"); var parent_list = infos[0]; - $("select[name=\"options_"+parent_list+"\"]").change(function() { + $("select[name="+parent_list+"]").change(function() { showOptions(child_list, parent_list); }); }); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 82ff69fe88a..44f10c5cf36 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -373,11 +373,11 @@ ExtrafieldCheckBox=Checkbox ExtrafieldRadio=Radio button ExtrafieldCheckBoxFromList= Checkbox from table ExtrafieldLink=Link to an object -ExtrafieldParamHelpselect=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
...

In order to have the list depending on another :
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key +ExtrafieldParamHelpselect=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
...

In order to have the list depending on another complementary attribute list :
1,value1|options_parent_list_code:parent_key
2,value2|options_parent_list_code:parent_key

In order to have the list depending on another list :
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key ExtrafieldParamHelpcheckbox=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
... ExtrafieldParamHelpradio=Parameters list have to be like key,value

for example :
1,value1
2,value2
3,value3
... -ExtrafieldParamHelpsellist=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter -ExtrafieldParamHelpchkbxlst=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another :
c_typent:libelle:id:parent_list_code|parent_column:filter +ExtrafieldParamHelpsellist=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another complementary attribute list:
c_typent:libelle:id:options_parent_list_code|parent_column:filter

In order to have the list depending on another list:
c_typent:libelle:id:parent_list_code|parent_column:filter +ExtrafieldParamHelpchkbxlst=Parameters list comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another complementary attribute list :
c_typent:libelle:id:options_parent_list_code|parent_column:filter

In order to have the list depending on another list:
c_typent:libelle:id:parent_list_code|parent_column:filter ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath
Syntax : ObjectName:Classpath
Example : Societe:societe/class/societe.class.php LibraryToBuildPDF=Library used for PDF generation WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' From 055a00a33804fd0f41f4f2c7655a72031c482407 Mon Sep 17 00:00:00 2001 From: florian HENRY Date: Fri, 27 Jan 2017 15:18:12 +0100 Subject: [PATCH 02/11] fix travis --- htdocs/core/class/commonobject.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 36999f12dc7..4a84ac6a829 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2151,6 +2151,8 @@ abstract class CommonObject */ function update_note($note,$suffix='') { + global $user; + if (! $this->table_element) { dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR); @@ -2167,6 +2169,7 @@ abstract class CommonObject $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql.= " SET note".$suffix." = ".(!empty($note)?("'".$this->db->escape($note)."'"):"NULL"); + $sql.= " ,".(in_array($this->table_element, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))?"fk_user_mod":"fk_user_modif")." = ".$user->id; $sql.= " WHERE rowid =". $this->id; dol_syslog(get_class($this)."::update_note", LOG_DEBUG); From e4fc52497e118ea792cacba84593721e32ff8a91 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 8 Feb 2017 06:18:56 +0100 Subject: [PATCH 03/11] New : [FP17] Accountancy - Add export of charts of accounts --- htdocs/core/modules/modAccounting.class.php | 19 ++++++++++++++++++- htdocs/langs/en_US/accountancy.lang | 1 + 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index e9c7fb309ad..92e63d8bf7c 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -72,7 +72,7 @@ class modAccounting extends DolibarrModules $this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module $this->phpmin = array(5, 3); // Minimum version of PHP required by module $this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module - $this->langfiles = array("accountancy"); + $this->langfiles = array("accountancy","compta"); // Constants $this->const = array(); @@ -288,6 +288,23 @@ class modAccounting extends DolibarrModules // Menus //------- $this->menu = 1; // This module add menu entries. They are coded into menu manager. + + // Exports + //-------- + $r=0; + + $r++; + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='Chartofaccounts'; + $this->export_icon[$r]='accounting'; + $this->export_permission[$r]=array(array("accounting","chartofaccount")); + $this->export_fields_array[$r]=array('ac.rowid'=>'ChartofaccountsId','ac.pcg_version'=>'Chartofaccounts','aa.rowid'=>'Id','aa.account_number'=>"AccountAccounting",'aa.label'=>"Label",'aa.account_parent'=>"Accountparent",'aa.pcg_type'=>"Pcgtype",'aa.pcg_subtype'=>'Pcgsubtype','aa.active'=>'Status'); + $this->export_TypeFields_array[$r]=array('ac.rowid'=>'List:accounting_system:pcg_version','aa.account_number'=>"Text",'aa.label'=>"Text",'aa.pcg_type'=>'Text','aa.pcg_subtype'=>'Text','aa.active'=>'Status'); + $this->export_entities_array[$r]=array('ac.rowid'=>"accounting",'ac.pcg_version'=>"accounting",'aa.rowid'=>'accounting','aa.account_number'=>"accounting",'aa.label'=>"accounting",'aa.accountparent'=>"accounting",'aa.pcg_type'=>"accounting",'aa.pcgsubtype'=>"accounting",'aa_active'=>"accounting"); + + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'accounting_account as aa, '.MAIN_DB_PREFIX.'accounting_system as ac'; + $this->export_sql_end[$r] .=' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting', 1).') '; } } diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index 5ee68e605cd..b56efc312e7 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -211,6 +211,7 @@ Modelcsv_ciel=Export towards Sage Ciel Compta or Compta Evolution Modelcsv_quadratus=Export towards Quadratus QuadraCompta Modelcsv_ebp=Export towards EBP Modelcsv_cogilog=Export towards Cogilog +ChartofaccountsId=Chart of accounts Id ## Tools - Init accounting account on product / service InitAccountancy=Init accountancy From 4126dcff03557703e1356f41aaf5ff808a286b56 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Wed, 8 Feb 2017 06:51:42 +0100 Subject: [PATCH 04/11] [FP17] Accountancy - Prepare fiscal year for a better complete accountancy. For the moment, remove function to update status and delete a fiscal year. Need controls and a specific function to block lines in the book keeping if the fiscal year is closed. --- htdocs/accountancy/admin/fiscalyear.php | 2 +- htdocs/accountancy/admin/fiscalyear_card.php | 11 +++++++---- htdocs/core/class/fiscalyear.class.php | 4 ++-- htdocs/langs/en_US/main.lang | 1 + 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 817905f7b56..4b2b57ee7db 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2013-2016 Alexandre Spangaro * * 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 diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 2c22d8f191a..7a8ab0673a7 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro * * 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 @@ -176,13 +176,15 @@ if ($action == 'create') print $form->select_date(($date_end ? $date_end : - 1), 'fiscalyearend'); print ''; + /* // Statut print ''; print '' . $langs->trans("Status") . ''; print ''; print $form->selectarray('statut', $statut2label, GETPOST('statut')); print ''; - + */ + print ''; dol_fiche_end(); @@ -232,7 +234,8 @@ if ($action == 'create') // Statut print '' . $langs->trans("Statut") . ''; - print $form->selectarray('statut', $statut2label, $object->statut); + // print $form->selectarray('statut', $statut2label, $object->statut); + print $object->getLibStatut(4); print ''; print ''; @@ -304,7 +307,7 @@ if ($action == 'create') print '' . $langs->trans('Modify') . ''; - print '' . $langs->trans('Delete') . ''; + // print '' . $langs->trans('Delete') . ''; print ''; } diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index ef990d8edf3..912c1e34879 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2017 Alexandre Spangaro * * 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 @@ -89,7 +89,7 @@ class Fiscalyear extends CommonObject $sql.= " '".$this->label."'"; $sql.= ", '".$this->db->idate($this->date_start)."'"; $sql.= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'":"null"); - $sql.= ", ".$this->statut; + $sql.= ", 0"; $sql.= ", ".$conf->entity; $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", ". $user->id; diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 1c9c74471ca..37725835e4a 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -756,6 +756,7 @@ SomeTranslationAreUncomplete=Some languages may be partially translated or may c DirectDownloadLink=Direct download link Download=Download ActualizeCurrency=Update currency rate +Fiscalyear=Fiscal year # Week day Monday=Monday Tuesday=Tuesday From 49e6192e6222133e03592d9bec95ea6b8057839f Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Wed, 8 Feb 2017 09:23:15 +0100 Subject: [PATCH 05/11] fix the type width column and the nextY --- .../doc/pdf_standard.modules.php | 61 +++++++++++-------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index abc40f23005..5db7e065b43 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -307,28 +307,29 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetFont('','', $default_font_size - 1); - // Accountancy piece - $pdf->SetXY($this->posxpiece, $curY); - $pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-0.8, 4, $this->posxpiece-1, $curY, $piece_comptable, 0, 1); - - // Comments - $pdf->SetXY($this->posxcomment, $curY); - $pdf->writeHTMLCell($this->posxdate-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $object->lines[$i]->comments, 0, 1); + // Accountancy piece + $pdf->SetXY($this->posxpiece, $curY); + $pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-0.8, 4, $this->posxpiece-1, $curY, $piece_comptable, 0, 1); - //nexY - $nexY = $pdf->GetY(); - $pageposafter=$pdf->getPage(); - $pdf->setPage($pageposbefore); - $pdf->setTopMargin($this->marge_haute); - $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + // Comments + $pdf->SetXY($this->posxcomment, $curY ); + $pdf->writeHTMLCell($this->posxdate-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $object->lines[$i]->comments, 0, 1); - // Date + // Date $pdf->SetXY($this->posxdate -1, $curY); $pdf->MultiCell($this->posxtype-$this->posxdate-0.8, 4, dol_print_date($object->lines[$i]->date,"day",false,$outputlangs), 0, 'C'); // Type $pdf->SetXY($this->posxtype -1, $curY); - $pdf->MultiCell($this->posxprojet-$this->posxtype-0.8, 4, dol_trunc($outputlangs->transnoentities($object->lines[$i]->type_fees_code), 12), 0, 'C'); + $nextColumnPosX = $this->posxup; + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { + $nextColumnPosX = $this->posxtva; + } + if (!empty($conf->projet->enabled)) { + $nextColumnPosX = $this->posxprojet; + } + + $pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, dol_trunc($outputlangs->transnoentities($object->lines[$i]->type_fees_code), 12), 0, 'C'); // Project if (! empty($conf->projet->enabled)) @@ -358,20 +359,30 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetXY($this->postotalttc-1, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 4, price($object->lines[$i]->total_ttc), 0, 'R'); - // Cherche nombre de lignes a venir pour savoir si place suffisante + //nexY + $nexY = $pdf->GetY(); + $pageposafter=$pdf->getPage(); + $pdf->setPage($pageposbefore); + $pdf->setTopMargin($this->marge_haute); + $pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it. + + $nblineFollowComment = 1; + // Cherche nombre de lignes a venir pour savoir si place suffisante if ($i < ($nblignes - 1)) // If it's not last line { - //on recupere la description du produit suivant - $follow_comment = $object->lines[$i+1]->comments; + //Fetch current description to know on which line the next one should be placed + $follow_comment = $object->lines[$i]->comments; + $follow_type = $object->lines[$i]->type_fees_code; + //on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres) - $nblineFollowComment = dol_nboflines_bis($follow_comment,52,$outputlangs->charset_output)*4; - } - else // If it's last line - { - $nblineFollowComment = 0; + $nbLineCommentNeed = dol_nboflines_bis($follow_comment,52,$outputlangs->charset_output); + $nbLineTypeNeed = dol_nboflines_bis($follow_type,4,$outputlangs->charset_output); + + //Which one need more lines + $nblineFollowComment = ($nbLineCommentNeed > $nbLineTypeNeed) ? $nbLineCommentNeed : $nbLineTypeNeed; } - $nexY+=4; // Passe espace entre les lignes + $nexY+=$nblineFollowComment*($pdf->getFontSize()+1); // Passe espace entre les lignes // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) @@ -426,7 +437,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->SetFont('','', 10); // Show total area box - $posy=$bottomlasttab+5;//$nexY+95; + $posy=$bottomlasttab+5; $pdf->SetXY(100, $posy); $pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalHT"), 1, 'L'); $pdf->SetXY(160, $posy); From ae3ace7e943537ba04e3ceea0cbc9c1c6e142969 Mon Sep 17 00:00:00 2001 From: Andreas Pachler Date: Wed, 8 Feb 2017 12:46:42 +0100 Subject: [PATCH 06/11] added additional payment terms often needed in Austria --- htdocs/install/mysql/data/llx_c_payment_term.sql | 6 ++++++ htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 8 +++++++- htdocs/langs/de_DE/bills.lang | 8 ++++++++ htdocs/langs/en_US/bills.lang | 8 ++++++++ htdocs/langs/fr_FR/bills.lang | 10 +++++++++- 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_payment_term.sql b/htdocs/install/mysql/data/llx_c_payment_term.sql index 783bf1e0daf..86a5078a4ef 100644 --- a/htdocs/install/mysql/data/llx_c_payment_term.sql +++ b/htdocs/install/mysql/data/llx_c_payment_term.sql @@ -35,3 +35,9 @@ insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_ insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (6,'PT_ORDER', 6,1, 'A réception de commande','A réception de commande',0,1); insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (7,'PT_DELIVERY', 7,1, 'Livraison','Règlement à la livraison',0,1); insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (8,'PT_5050', 8,1, '50 et 50','Règlement 50% à la commande, 50% à la livraison',0,1); + +-- add additional payment terms often needed in Austria +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (9,'10D', 2,1, '30 jours','Réglement à 10 jours',0,10); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (10,'10DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 10 jours fin de mois',1,10); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (11,'14D', 2,1, '30 jours','Réglement à 14 jours',0,14); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (12,'14DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 14 jours fin de mois',1,14); diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index 16a9b566bf5..b8441ac4190 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -286,4 +286,10 @@ CREATE TABLE llx_product_attribute_value value VARCHAR(255) DEFAULT NULL, entity INT DEFAULT 1 NOT NULL ); -ALTER TABLE llx_product_attribute_value ADD CONSTRAINT unique_ref UNIQUE (fk_product_attribute,ref); \ No newline at end of file +ALTER TABLE llx_product_attribute_value ADD CONSTRAINT unique_ref UNIQUE (fk_product_attribute,ref); + +-- add additional payment terms often needed in Austria +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (9,'10D', 2,1, '30 jours','Réglement à 10 jours',0,10); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (10,'10DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 10 jours fin de mois',1,10); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (11,'14D', 2,1, '30 jours','Réglement à 14 jours',0,14); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (12,'14DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 14 jours fin de mois',1,14); diff --git a/htdocs/langs/de_DE/bills.lang b/htdocs/langs/de_DE/bills.lang index 261da362f7a..00d5052330c 100644 --- a/htdocs/langs/de_DE/bills.lang +++ b/htdocs/langs/de_DE/bills.lang @@ -351,6 +351,14 @@ PaymentConditionShortPT_ORDER=Bestellung PaymentConditionPT_ORDER=Bei Bestellung PaymentConditionShortPT_5050=50-50 PaymentConditionPT_5050=50%% im Voraus, 50%% bei Lieferung +PaymentConditionShort10D=10 Tage +PaymentCondition10D=10 Tage netto +PaymentConditionShort10DENDMONTH=10 Tage ab Monatsende +PaymentCondition10DENDMONTH=Innerhalb von 10 Tagen, nach Monatsende +PaymentConditionShort14D=14 Tage +PaymentCondition14D=14 Tage netto +PaymentConditionShort14DENDMONTH=14 Tage ab Monatsende +PaymentCondition14DENDMONTH=Innerhalb von 14 Tagen, nach Monatsende FixAmount=Fester Betrag VarAmount=Variabler Betrag (%% tot.) # PaymentType diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index 837d09a79b3..1cd65446b90 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -355,6 +355,14 @@ PaymentConditionShortPT_ORDER=Order PaymentConditionPT_ORDER=On order PaymentConditionShortPT_5050=50-50 PaymentConditionPT_5050=50%% in advance, 50%% on delivery +PaymentConditionShort10D=10 days +PaymentCondition10D=10 days +PaymentConditionShort10DENDMONTH=10 days of month-end +PaymentCondition10DENDMONTH=Within 10 days following the end of the month +PaymentConditionShort14D=14 days +PaymentCondition14D=14 days +PaymentConditionShort14DENDMONTH=14 days of month-end +PaymentCondition14DENDMONTH=Within 14 days following the end of the month FixAmount=Fix amount VarAmount=Variable amount (%% tot.) # PaymentType diff --git a/htdocs/langs/fr_FR/bills.lang b/htdocs/langs/fr_FR/bills.lang index 7f58225576a..f0473d737fa 100644 --- a/htdocs/langs/fr_FR/bills.lang +++ b/htdocs/langs/fr_FR/bills.lang @@ -351,6 +351,14 @@ PaymentConditionShortPT_ORDER=A commande PaymentConditionPT_ORDER=À réception de commande PaymentConditionShortPT_5050=50/50 PaymentConditionPT_5050=Règlement 50%% d'avance, 50%% à la livraison +PaymentConditionShort10D=10 jours +PaymentCondition10D=Règlement à 10 jours +PaymentConditionShort10DENDMONTH=10 jours fin de mois +PaymentCondition10DENDMONTH=Règlement à 10 jours fin de mois +PaymentConditionShort14D=14 jours +PaymentCondition14D=Règlement à 14 jours +PaymentConditionShort14DENDMONTH=14 jours fin de mois +PaymentCondition14DENDMONTH=Règlement à 14 jours fin de mois FixAmount=Montant Fixe VarAmount=Montant variable (%% tot.) # PaymentType @@ -492,4 +500,4 @@ ConfirmDeleteRepeatableInvoice=Est-ce votre sûr de vouloir supprimer la facture CreateOneBillByThird=Créer une facture par tiers (sinon, une facture par commande) BillCreated=%s facture(s) créée(s) WithdrawRequest=Demande de prélèvement -BadPaymentMethod=Mauvais mode de paiement \ No newline at end of file +BadPaymentMethod=Mauvais mode de paiement From c45b40075d39ab6366abcba93191a5c814118007 Mon Sep 17 00:00:00 2001 From: Andreas Pachler Date: Wed, 8 Feb 2017 12:55:03 +0100 Subject: [PATCH 07/11] fixed typos --- htdocs/install/mysql/data/llx_c_payment_term.sql | 8 ++++---- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/install/mysql/data/llx_c_payment_term.sql b/htdocs/install/mysql/data/llx_c_payment_term.sql index 86a5078a4ef..c7fd08a62d6 100644 --- a/htdocs/install/mysql/data/llx_c_payment_term.sql +++ b/htdocs/install/mysql/data/llx_c_payment_term.sql @@ -37,7 +37,7 @@ insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_ insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (8,'PT_5050', 8,1, '50 et 50','Règlement 50% à la commande, 50% à la livraison',0,1); -- add additional payment terms often needed in Austria -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (9,'10D', 2,1, '30 jours','Réglement à 10 jours',0,10); -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (10,'10DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 10 jours fin de mois',1,10); -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (11,'14D', 2,1, '30 jours','Réglement à 14 jours',0,14); -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (12,'14DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 14 jours fin de mois',1,14); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (9,'10D', 9,1, '10 jours','Réglement à 10 jours',0,10); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (10,'10DENDMONTH', 10,1, '10 jours fin de mois','Réglement à 10 jours fin de mois',1,10); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (11,'14D', 11,1, '14 jours','Réglement à 14 jours',0,14); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (12,'14DENDMONTH', 12,1, '14 jours fin de mois','Réglement à 14 jours fin de mois',1,14); diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index b8441ac4190..29832ee6765 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -289,7 +289,7 @@ CREATE TABLE llx_product_attribute_value ALTER TABLE llx_product_attribute_value ADD CONSTRAINT unique_ref UNIQUE (fk_product_attribute,ref); -- add additional payment terms often needed in Austria -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (9,'10D', 2,1, '30 jours','Réglement à 10 jours',0,10); -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (10,'10DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 10 jours fin de mois',1,10); -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (11,'14D', 2,1, '30 jours','Réglement à 14 jours',0,14); -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (12,'14DENDMONTH', 3,1, '30 jours fin de mois','Réglement à 14 jours fin de mois',1,14); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (9,'10D', 9,1, '10 jours','Réglement à 10 jours',0,10); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (10,'10DENDMONTH', 10,1, '10 jours fin de mois','Réglement à 10 jours fin de mois',1,10); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (11,'14D', 11,1, '14 jours','Réglement à 14 jours',0,14); +insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (12,'14DENDMONTH', 12,1, '14 jours fin de mois','Réglement à 14 jours fin de mois',1,14); From 072fa9987bf24cf837c89595af39d4e4b4352d3c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 8 Feb 2017 16:47:27 +0100 Subject: [PATCH 08/11] Update 4.0.0-5.0.0.sql --- htdocs/install/mysql/migration/4.0.0-5.0.0.sql | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql index 29832ee6765..456d5942549 100644 --- a/htdocs/install/mysql/migration/4.0.0-5.0.0.sql +++ b/htdocs/install/mysql/migration/4.0.0-5.0.0.sql @@ -287,9 +287,3 @@ CREATE TABLE llx_product_attribute_value entity INT DEFAULT 1 NOT NULL ); ALTER TABLE llx_product_attribute_value ADD CONSTRAINT unique_ref UNIQUE (fk_product_attribute,ref); - --- add additional payment terms often needed in Austria -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (9,'10D', 9,1, '10 jours','Réglement à 10 jours',0,10); -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (10,'10DENDMONTH', 10,1, '10 jours fin de mois','Réglement à 10 jours fin de mois',1,10); -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (11,'14D', 11,1, '14 jours','Réglement à 14 jours',0,14); -insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (12,'14DENDMONTH', 12,1, '14 jours fin de mois','Réglement à 14 jours fin de mois',1,14); From 22b85b3aba8ea01773b51fe9002cbd14c1fb5a83 Mon Sep 17 00:00:00 2001 From: Ion Date: Wed, 8 Feb 2017 17:30:51 +0100 Subject: [PATCH 09/11] Show delay in syslog --- htdocs/core/modules/syslog/mod_syslog_file.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index b1060677c6f..1e8d2b3a91c 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -8,6 +8,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php'; class mod_syslog_file extends LogHandler implements LogHandlerInterface { var $code = 'file'; + var $lastTime = 0; /** * Return name of logger @@ -145,9 +146,16 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface LOG_INFO => 'INFO', LOG_DEBUG => 'DEBUG' ); - - $message = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident>0?str_pad('',$this->ident,' '):'').$content['message']; - + + $delay = ""; + if (!empty($conf->global->MAIN_SYSLOG_SHOW_DELAY)) + { + $now = microtime(true); + $delay = " ".sprintf("%05.3f", $this->lastTime != 0 ? $now - $this->lastTime : 0); + $this->lastTime = $now; + } + + $message = dol_print_date(time(),"%Y-%m-%d %H:%M:%S").$delay." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident>0?str_pad('',$this->ident,' '):'').$content['message']; fwrite($filefd, $message."\n"); fclose($filefd); @chmod($logfile, octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK)); From a042c30b285be5d431d7ca41ba1e0c51b7a97323 Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Wed, 8 Feb 2017 19:00:48 +0100 Subject: [PATCH 10/11] fix nex line --- .../doc/pdf_standard.modules.php | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 5db7e065b43..56204fda6bb 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -284,7 +284,7 @@ class pdf_standard extends ModeleExpenseReport } $iniY = $tab_top + 7; - $curY = $tab_top + 7; + $initialY = $tab_top + 7; $nexY = $tab_top + 7; // Loop on each lines @@ -292,34 +292,31 @@ class pdf_standard extends ModeleExpenseReport { $piece_comptable = $i +1; - $curY = $nexY; $pdf->SetFont('','', $default_font_size - 2); // Into loop to work with multipage $pdf->SetTextColor(0,0,0); $pdf->setTopMargin($tab_top_newpage); $pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it. $pageposbefore=$pdf->getPage(); - - // Description of product line - $curX = $this->posxcomment-1; - - $showpricebeforepagebreak=1; + $curY = $nexY; $pdf->SetFont('','', $default_font_size - 1); // Accountancy piece $pdf->SetXY($this->posxpiece, $curY); $pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-0.8, 4, $this->posxpiece-1, $curY, $piece_comptable, 0, 1); + $curY = ($pdf->PageNo() > $pageposbefore) ? $pdf->GetY()-4 : $curY; // Comments $pdf->SetXY($this->posxcomment, $curY ); $pdf->writeHTMLCell($this->posxdate-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $object->lines[$i]->comments, 0, 1); + $curY = ($pdf->PageNo() > $pageposbefore) ? $pdf->GetY()-4 : $curY; // Date $pdf->SetXY($this->posxdate -1, $curY); $pdf->MultiCell($this->posxtype-$this->posxdate-0.8, 4, dol_print_date($object->lines[$i]->date,"day",false,$outputlangs), 0, 'C'); - // Type + // Type $pdf->SetXY($this->posxtype -1, $curY); $nextColumnPosX = $this->posxup; if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) { @@ -345,17 +342,17 @@ class pdf_standard extends ModeleExpenseReport $vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails); $pdf->SetXY($this->posxtva, $curY); $pdf->MultiCell($this->posxup-$this->posxtva-0.8, 4,$vat_rate, 0, 'C'); - } + } // Unit price $pdf->SetXY($this->posxup, $curY); $pdf->MultiCell($this->posxqty-$this->posxup-0.8, 4,price($object->lines[$i]->value_unit), 0, 'R'); - // Quantity + // Quantity $pdf->SetXY($this->posxqty, $curY); $pdf->MultiCell($this->postotalttc-$this->posxqty-0.8, 4,$object->lines[$i]->qty, 0, 'R'); - // Total with all taxes + // Total with all taxes $pdf->SetXY($this->postotalttc-1, $curY); $pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 4, price($object->lines[$i]->total_ttc), 0, 'R'); @@ -378,11 +375,10 @@ class pdf_standard extends ModeleExpenseReport $nbLineCommentNeed = dol_nboflines_bis($follow_comment,52,$outputlangs->charset_output); $nbLineTypeNeed = dol_nboflines_bis($follow_type,4,$outputlangs->charset_output); - //Which one need more lines - $nblineFollowComment = ($nbLineCommentNeed > $nbLineTypeNeed) ? $nbLineCommentNeed : $nbLineTypeNeed; + $nblineFollowComment = max($nbLineCommentNeed, $nbLineTypeNeed); } - $nexY+=$nblineFollowComment*($pdf->getFontSize()+1); // Passe espace entre les lignes + $nexY+=$nblineFollowComment*($pdf->getFontSize()*1.3); // Passe espace entre les lignes // Detect if some page were added automatically and output _tableau for past pages while ($pagenb < $pageposafter) From 439bda053d360d1f11e214b18502b202f7bd4a31 Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Wed, 8 Feb 2017 19:18:16 +0100 Subject: [PATCH 11/11] fix correct url for expense report note in expense report list --- htdocs/expensereport/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index cb54414fe35..13b95311dee 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -543,7 +543,7 @@ if ($resql) if (!empty($obj->note_private) || !empty($obj->note_public)) { print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; + print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; print ''; } print '';