diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 5d0b1133a00..08d4e31ec6b 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2181,7 +2181,7 @@ if ($action == 'create') } $arrayofinvoiceforpropal = $object->getInvoiceArrayList(); - if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || ! empty($conf->global->WORKFLOW_PROPAL_CAN_CLASSIFIED_BILLED_WITHOUT_INVOICES)) + if ((is_array($arrayofinvoiceforpropal) && count($arrayofinvoiceforpropal) > 0) || empty($conf->global->WORKFLOW_PROPAL_NEED_INVOICE_TO_BE_CLASSIFIED_BILLED)) { print '
socid . '">' . $langs->trans("ClassifyBilled") . '
'; } diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index a178abae47c..f2148f8e063 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1870,7 +1870,7 @@ if ($action == 'create') $objectsrc->fetch_lines(); $objectsrc->fetch_thirdparty(); - $projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); + $projectid = (! empty($projectid) ? $projectid : $objectsrc->fk_project); $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); $ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : ''); @@ -2250,9 +2250,6 @@ if ($action == 'create') // Project if (! empty($conf->projet->enabled) && $socid > 0) { - $projectid = GETPOST('projectid')?GETPOST('projectid'):0; - if ($origin == 'project') $projectid = ($originid ? $originid : 0); - $langs->load('projects'); print '' . $langs->trans('Project') . ''; $numprojet = $formproject->select_projects($soc->id, $projectid, 'projectid', 0); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index fc090ef52e0..43160b68f99 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -281,7 +281,7 @@ if ($resql) if ($search_user > 0) $param.='&search_user=' .$search_user; if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht; if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc; - if ($search_status > 0) $param.='&search_status='.$search_status; + if ($search_status != '') $param.='&search_status='.$search_status; print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy.png'); $i = 0; diff --git a/htdocs/compta/facture/mergepdftool.php b/htdocs/compta/facture/mergepdftool.php index 9745f4b1b01..e0b821683ce 100644 --- a/htdocs/compta/facture/mergepdftool.php +++ b/htdocs/compta/facture/mergepdftool.php @@ -417,6 +417,7 @@ $search_societe = GETPOST("search_societe"); $search_paymentmode = GETPOST("search_paymentmode"); $search_montant_ht = GETPOST("search_montant_ht"); $search_montant_ttc = GETPOST("search_montant_ttc"); +$search_status = GETPOST("search_status"); $late = GETPOST("late"); // Do we click on purge search criteria ? @@ -428,6 +429,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_paymentmode=''; $search_montant_ht=''; $search_montant_ttc=''; + $search_status=''; } $sortfield = GETPOST("sortfield",'alpha'); @@ -483,6 +485,7 @@ if ($search_paymentmode) $sql .= " AND f.fk_mode_reglement = ".$search_paymentmo if ($search_montant_ht) $sql .= " AND f.total = '".$db->escape($search_montant_ht)."'"; if ($search_montant_ttc) $sql .= " AND f.total_ttc = '".$db->escape($search_montant_ttc)."'"; if (GETPOST('sf_ref')) $sql .= " AND f.facnumber LIKE '%".$db->escape(GETPOST('sf_ref'))."%'"; +if ($search_status) $sql .= " AND f.fk_statut = ".$search_status; if ($month > 0) { if ($year > 0) @@ -528,6 +531,7 @@ if ($resql) if ($search_societe) $param.='&search_paymentmode='.urlencode($search_paymentmode); if ($search_montant_ht) $param.='&search_montant_ht='.urlencode($search_montant_ht); if ($search_montant_ttc) $param.='&search_montant_ttc='.urlencode($search_montant_ttc); + if ($search_status) $param.='&search_status='.urlencode($search_status); if ($late) $param.='&late='.urlencode($late); if ($mode) $param.='&mode='.urlencode($mode); $urlsource=$_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 41ae45ef638..24c2fe34a93 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -388,11 +388,16 @@ abstract class CommonDocGenerator // Add vat by rates foreach ($object->lines as $line) { + // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility if (empty($resarray[$array_key.'_total_vat_'.$line->tva_tx])) $resarray[$array_key.'_total_vat_'.$line->tva_tx]=0; $resarray[$array_key.'_total_vat_'.$line->tva_tx]+=$line->total_tva; $resarray[$array_key.'_total_vat_locale_'.$line->tva_tx]=price($resarray[$array_key.'_total_vat_'.$line->tva_tx]); + // $vatformated is vat without not expected chars (so 20, or 8.5 or 5.99 for example) + $vatformated=vatrate($line->tva_tx); + if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0; + $resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva; + $resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]); } - // Retrieve extrafields if (is_array($object->array_options) && count($object->array_options)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 0750d1d24b0..b7db522458e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5223,7 +5223,6 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0) return $res; } - /** * Return the filename of file to get the thumbs * diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index 36596165191..c421fdb1aeb 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -91,7 +91,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= if (! $passok) { if ((! $passcrypted || $passtyped) - && ($passtyped == $passclear)) + && ($passclear && ($passtyped == $passclear))) { $passok=true; dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentification ok - found pass in database"); diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 35308ef7e0d..38c16797fa7 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -1575,6 +1575,7 @@ class CommandeFournisseur extends CommonOrder $result=$this->call_trigger('ORDER_SUPPLIER_DELETE',$user); if ($result < 0) { + $this->errors[]='ErrorWhenRunningTrigger'; dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); return -1; } @@ -1587,6 +1588,8 @@ class CommandeFournisseur extends CommonOrder dol_syslog(get_class($this)."::delete", LOG_DEBUG); if (! $this->db->query($sql) ) { + $this->error=$this->db->lasterror(); + $this->errors[]=$this->db->lasterror(); $error++; } @@ -1597,12 +1600,14 @@ class CommandeFournisseur extends CommonOrder if ($this->db->affected_rows($resql) < 1) { $this->error=$this->db->lasterror(); + $this->errors[]=$this->db->lasterror(); $error++; } } else { $this->error=$this->db->lasterror(); + $this->errors[]=$this->db->lasterror(); $error++; } @@ -1612,6 +1617,8 @@ class CommandeFournisseur extends CommonOrder $result=$this->deleteExtraFields(); if ($result < 0) { + $this->error='FailToDeleteExtraFields'; + $this->errors[]='FailToDeleteExtraFields'; $error++; dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); } @@ -1619,7 +1626,11 @@ class CommandeFournisseur extends CommonOrder // Delete linked object $res = $this->deleteObjectLinked(); - if ($res < 0) $error++; + if ($res < 0) { + $this->error='FailToDeleteObjectLinked'; + $this->errors[]='FailToDeleteObjectLinked'; + $error++; + } if (! $error) { @@ -1634,6 +1645,7 @@ class CommandeFournisseur extends CommonOrder if (! dol_delete_file($file,0,0,0,$this)) // For triggers { $this->error='ErrorFailToDeleteFile'; + $this->errors[]='ErrorFailToDeleteFile'; $error++; } } @@ -1643,6 +1655,7 @@ class CommandeFournisseur extends CommonOrder if (! $res) { $this->error='ErrorFailToDeleteDir'; + $this->errors[]='ErrorFailToDeleteDir'; $error++; } } diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index ccf7169219b..4252e4a9ef6 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -94,9 +94,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_company=""; $search_amount_no_tax=""; $search_amount_all_tax=""; + $search_status=""; $year=""; $month=""; - $filter=""; } // List of fields to search into when doing a "search in all" @@ -162,15 +162,6 @@ if ($socid) { $sql .= " AND s.rowid = ".$socid; } -if ($filter && $filter != -1) // GETPOST('filtre') may be a string -{ - $filtrearr = explode(",", $filter); - foreach ($filtrearr as $fil) - { - $filt = explode(":", $fil); - $sql .= " AND " . $filt[0] . " = " . $filt[1]; - } -} if ($search_all) { $sql.= natural_search(array_keys($fieldstosearchall), $search_all); @@ -232,7 +223,7 @@ if ($search_amount_all_tax != '') if ($search_status != '') { - $sql.= " AND fac.fk_statut = '".$db->escape($search_status)."'"; + $sql.= " AND fac.fk_statut = ".$search_status; } $nbtotalofrecords = 0; @@ -268,6 +259,7 @@ if ($resql) if ($search_amount_all_tax) $param.='&search_amount_all_tax='.urlencode($search_amount_all_tax); if ($filter && $filter != -1) $param.='&filtre='.urlencode($filter); if ($optioncss != '') $param.='&optioncss='.$optioncss; + if ($search_status >= 0) $param.="&search_status=".$search_status; print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); print '
'; @@ -337,8 +329,8 @@ if ($resql) print ''; print ''; print ''; - $liststatus=array('fac.fk_statut:0'=>$langs->trans("Draft"),'fac.fk_statut:1,paye:0'=>$langs->trans("Unpaid"), 'paye:1'=>$langs->trans("Paid")); - print $form->selectarray('filtre', $liststatus, $filter, 1); + $liststatus=array('0'=>$langs->trans("Draft"),'1'=>$langs->trans("Unpaid"), '2'=>$langs->trans("Paid")); + print $form->selectarray('filtre', $liststatus, $search_status, 1); print ''; print ''; print ''; diff --git a/htdocs/install/doctemplates/invoices/template_invoice.odt b/htdocs/install/doctemplates/invoices/template_invoice.odt index e9cd7c836fb..dad29a292ef 100644 Binary files a/htdocs/install/doctemplates/invoices/template_invoice.odt and b/htdocs/install/doctemplates/invoices/template_invoice.odt differ diff --git a/htdocs/langs/en_US/workflow.lang b/htdocs/langs/en_US/workflow.lang index 7414fcb7e62..14be1a6ade6 100644 --- a/htdocs/langs/en_US/workflow.lang +++ b/htdocs/langs/en_US/workflow.lang @@ -3,9 +3,9 @@ WorkflowSetup=Workflow module setup WorkflowDesc=This module is designed to modify the behaviour of automatic actions into application. By default, workflow is open (you can do things in the order you want). You can activate the automatic actions you are interested in. ThereIsNoWorkflowToModify=There is no workflow modifications available with the activated modules. descWORKFLOW_PROPAL_AUTOCREATE_ORDER=Automatically create a customer order after a commercial proposal is signed -descWORKFLOW_PROPAL_AUTOCREATE_INVOICEAutomatically create a customer invoice after a commercial proposal is signed -descWORKFLOW_CONTRACT_AUTOCREATE_INVOICEAutomatically create a customer invoice after a contract is validated -descWORKFLOW_ORDER_AUTOCREATE_INVOICEAutomatically create a customer invoice after a customer order is closed +descWORKFLOW_PROPAL_AUTOCREATE_INVOICE=Automatically create a customer invoice after a commercial proposal is signed +descWORKFLOW_CONTRACT_AUTOCREATE_INVOICE=Automatically create a customer invoice after a contract is validated +descWORKFLOW_ORDER_AUTOCREATE_INVOICE=Automatically create a customer invoice after a customer order is closed descWORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL=Classify linked source proposal to billed when customer order is set to paid descWORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is set to paid descWORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER=Classify linked source customer order(s) to billed when customer invoice is validated diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 4ece8af95c2..608957aa52d 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1488,7 +1488,7 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a // Login name with photo and tooltip $mode=-1; $toprightmenu.='
'; $toprightmenu.='';