diff --git a/ChangeLog b/ChangeLog index 1bb297bae79..e3d40f3a04c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -162,6 +162,47 @@ So if you included it into your module, change your code like this to be compati + +***** ChangeLog for 3.9.2 compared to 3.9.1 ***** +FIX: #4813 Won translation for the key OppStatusWON instead OppStatusWIN +FIX: #5008 SQL error when editing the reference of a supplier invoice that already exists +FIX: #5236 Cron module activated but "Modules tools" does not appear in the left menu. +FIX: Accountancy - 3.9 - Chart of accounts are limited on only one country +FIX: bug on email template +FIX: Can't create a stock transfer from product card +FIX: can't fetch by siret or siren because of first "if" +FIX: Check stock of product by warehouse if $entrepot_id defined on shippings +FIX: Compatible with multicompany +FIX: Creation of the second ressource type fails. +FIX: end of select when no fournprice +FIX: Filter on assigned to was preselected on current user on list "All events" (instead of no filtering) +FIX: Filter on category tag for suppliers +FIX: hook on group card called but not initialized +FIX: Infinite loop on menu tree output for edition +FIX: Can show tree of entries added by external modules using fk_mainmenu and fk_leftmenu instead of fk_menu. +FIX: init var at wrong place report incorrect "shippable" flag on draft order. +FIX: It doesn't check if there is enough stock to update the lines of orders/invoices +FIX: Menu statistics was not visible if module proposal was not enabled +FIX: Merge manually PR #5161 - Bad translation key +FIX: missing column when module was installed before standard integration +FIX: Missing number total of modules +FIX: Not filtering correctly when coming from dashboard +FIX: PROPAL_MERGE_PDF with PRODUCT_USE_OLD_PATH +FIX: Remove PHP Warning: Creating default object from empty value. +FIX: same page added several times on mergepropal option +FIX: search on date into supplier invoice list dont work because of status -1 +FIX: Search supplier ref on contract +FIX: Split of credit note into discount page generates records not correctly recognised as credit note. +FIX: SQL error function on getAvailableDiscounts function, on bill create mode if socid is empty +FIX: #5087 +FIX: #5108 +FIX: #5163 +FIX: #5195 +FIX: #5203 +FIX: #5207 +FIX: #5209 +FIX: #5230 + ***** ChangeLog for 3.9.1 compared to 3.9.* ***** FIX: #3815 Call to undefined function local_by_date() FIX: #4424 Missing email of user popup in supplier orders area diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 8dacb956dd4..638e9794fe8 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 @@ -50,7 +50,7 @@ if (! $user->rights->accounting->fiscalyear) $error = 0; -// List of statut +// List of status static $tmpstatut2label = array ( '0' => 'OpenFiscalYear', '1' => 'CloseFiscalYear' diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index cf51092a4de..e67b18a5989 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -472,7 +472,15 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - + else if ($action == 'classifyunbilled' && $user->rights->commande->creer) + { + $ret=$object->classifyUnBilled(); + + if ($ret < 0) { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + // Positionne ref commande client else if ($action == 'set_ref_client' && $user->rights->commande->creer) { $object->set_ref_client($user, GETPOST('ref_client')); @@ -2552,7 +2560,11 @@ if ($action == 'create' && $user->rights->commande->creer) print '
' . $langs->trans("ClassifyBilled") . '
'; } } - + if ($object->statut > Commande::STATUS_DRAFT && $object->billed) { + if ($user->rights->commande->creer && $object->statut >= Commande::STATUS_VALIDATED && empty($conf->global->WORKFLOW_DISABLE_CLASSIFY_BILLED_FROM_ORDER) && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT)) { + print '
' . $langs->trans("ClassifyUnBilled") . '
'; + } + } // Clone if ($user->rights->commande->creer) { print '
' . $langs->trans("ToClone") . '
'; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f5ea791a02d..3ecbe763d0b 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2486,7 +2486,57 @@ class Commande extends CommonOrder return $this->classifyBilled($user); } - + /** + * Classify the order as not invoiced + * + * @return int <0 if ko, >0 if ok + */ + function classifyUnBilled() + { + global $conf, $user, $langs; + $error = 0; + + $this->db->begin(); + + $sql = 'UPDATE '.MAIN_DB_PREFIX.'commande SET facture = 0'; + $sql.= ' WHERE rowid = '.$this->id.' AND fk_statut > '.self::STATUS_DRAFT; + + dol_syslog(get_class($this)."::classifyUnBilled", LOG_DEBUG); + if ($this->db->query($sql)) + { + // Call trigger + $result=$this->call_trigger('ORDER_CLASSIFY_UNBILLED',$user); + if ($result < 0) $error++; + // End call triggers + + if (! $error) + { + $this->facturee=0; // deprecated + $this->billed=0; + + $this->db->commit(); + return 1; + } + else + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::classifyUnBilled ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; + } + } + else + { + $this->error=$this->db->error(); + $this->db->rollback(); + return -1; + } + } + + /** * Update a line in database * diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 42f9a440929..375288ce754 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -423,21 +423,22 @@ if (empty($reshook)) // Check parameters - // Check for mandatory prof id - for($i = 1; $i < 6; $i ++) + // Check for mandatory prof id (but only if country is than than ours) + if ($mysoc->country_id > 0 && $object->thirdparty->country_id == $mysoc->country_id) { - $idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY'; - $idprof = 'idprof' . $i; - if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) - { - if (! $error) - $langs->load("errors"); - $error ++; - - setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors'); - } + for ($i = 1; $i <= 6; $i++) + { + $idprof_mandatory = 'SOCIETE_IDPROF' . ($i) . '_INVOICE_MANDATORY'; + $idprof = 'idprof' . $i; + if (! $object->thirdparty->$idprof && ! empty($conf->global->$idprof_mandatory)) + { + if (! $error) $langs->load("errors"); + $error++; + setEventMessages($langs->trans('ErrorProdIdIsMandatory', $langs->transcountry('ProfId' . $i, $object->thirdparty->country_code)), null, 'errors'); + } + } } - + $qualified_for_stock_change = 0; if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 7cb0e35e463..c6efa6ab3e1 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1000,7 +1000,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks= $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = p.fk_soc"; $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; $sql2.= " WHERE p.rowid IN (".join(',',$arrayidofprojects).")"; - $sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee"; + $sql2.= " GROUP BY p.rowid, p.ref, p.title, p.fk_soc, s.nom, p.fk_user_creat, p.public, p.fk_statut, p.fk_opp_status, p.opp_amount, p.dateo, p.datee"; $sql2.= " ORDER BY p.title, p.ref"; $var=true; diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php index 589265fe354..83a3d590633 100644 --- a/htdocs/societe/soc.php +++ b/htdocs/societe/soc.php @@ -403,7 +403,7 @@ if (empty($reshook)) // Only for companies if (!($object->particulier || $private)) { - for ($i = 1; $i < 5; $i++) + for ($i = 1; $i <= 6; $i++) { $slabel="idprof".$i; $_POST[$slabel]=trim($_POST[$slabel]); @@ -418,15 +418,18 @@ if (empty($reshook)) } } - $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - - if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) - { - $langs->load("errors"); - $error++; - $errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code)); - $action = (($action=='add'||$action=='create')?'create':'edit'); - } + // Check for mandatory prof id (but only if country is than than ours) + if ($mysoc->country_id > 0 && $object->country_id == $mysoc->country_id) + { + $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; + if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) + { + $langs->load("errors"); + $error++; + $errors[] = $langs->trans("ErrorProdIdIsMandatory", $langs->transcountry('ProfId'.$i, $object->country_code)); + $action = (($action=='add'||$action=='create')?'create':'edit'); + } + } } } }