diff --git a/ChangeLog b/ChangeLog index 9ae46a57e40..c7c373ebaaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -186,6 +186,8 @@ Dolibarr better: - If you used warehouse/stock module, recheck setup of stock increase/decrease rules of the warehouse module and your Point Of Sale module if you use one. +***** ChangeLog for 3.6.3 compared to 3.6.2 ***** +- Fix: ref_ext was not saved when recording a customer order from web service ***** ChangeLog for 3.6.2 compared to 3.6.1 ***** - Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice. diff --git a/htdocs/.gitignore b/htdocs/.gitignore index 3cba3ce99cd..bf99a2deebe 100644 --- a/htdocs/.gitignore +++ b/htdocs/.gitignore @@ -1,5 +1,4 @@ /test.php -/custom* /extensions* /nltechno* /ancot* diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index df9632761dd..e3524425c6c 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -520,17 +520,17 @@ else $var=!$var; print "\n"; $url='http://www.dolistore.com'; - print ''; + print ''; print ''.$langs->trans("DoliStoreDesc").''; - print ''.$url.''; + print ''.$url.''; print ''; $var=!$var; print "\n"; $url='http://partners.dolibarr.org'; - print ''; + print ''; print ''.$langs->trans("DoliPartnersDesc").''; - print ''.$url.''; + print ''.$url.''; print ''; print "\n"; diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index e7490225107..532293cdad2 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -51,8 +51,8 @@ print ''; print $langs->trans("Developpers").':'; print ''; //print "
\n"; @@ -61,31 +61,31 @@ print $langs->trans("OtherInformations").':'; print ''; print $langs->trans("Demo").':'; print ''; print $langs->trans("ModulesMarketPlaces").':'; print ''; @@ -94,7 +94,7 @@ print $langs->trans("HelpCenter").':'; print ''; @@ -104,11 +104,11 @@ print ''; @@ -120,11 +120,11 @@ $url='http://saas.dolibarr.org'; $title=$langs->trans("OfficialWebHostingService if (preg_match('/^fr_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Solutions_de_Cloud'; if (preg_match('/^es_/i',$langs->getDefaultLang())) $url='http://wiki.dolibarr.org/index.php/Soluciones_en_la_Nube'; print '
  • '; -print ''.$title.''; +print ''.$title.''; print '
  • '; $url='http://partners.dolibarr.org'; $title=$langs->trans("ReferencedPreferredPartners"); print '
  • '; -print ''.$title.''; +print ''.$title.''; print '
  • '; print ''; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 203776bc7f9..0831571ace1 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -485,7 +485,7 @@ function backup_tables($outputfile, $tables='*') $row[$j] = "''"; } elseif(is_numeric($row[$j]) and !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0) // if it's a number, we return it as-is - $row[$j] = $row[$j]; +// $row[$j] = $row[$j]; } else { // else for all other cases we escape the value and put quotes around $row[$j] = addslashes($row[$j]); $row[$j] = preg_replace("#\n#", "\\n", $row[$j]); diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index 47116705320..338c0f23b16 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -193,9 +193,9 @@ $langs->load("cashdesk"); if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0) { $langs->load("errors"); - print ''; + print ''; } - else print ''; + else print ''; print ''; ?> diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 6a7d5f111da..5f1cb8f7c28 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -350,7 +350,7 @@ class ActionComm extends CommonObject $this->label = $obj->label; $this->datep = $this->db->jdate($obj->datep); $this->datef = $this->db->jdate($obj->datep2); - $this->durationp = $this->durationp; // deprecated +// $this->durationp = $this->durationp; // deprecated $this->datec = $this->db->jdate($obj->datec); $this->datem = $this->db->jdate($obj->datem); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 7fa67695860..a53628e3d31 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -136,6 +136,17 @@ $form=new Form($db); $nav=''; $nav.='  
    '; +if ($actioncode || isset($_GET['actioncode']) || isset($_POST['actioncode'])) $nav.=''; +if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.=''; +if ($filter) $nav.=''; +if ($filtera) $nav.=''; +if ($filtert) $nav.=''; +if ($filterd) $nav.=''; +if ($socid) $nav.=''; +if ($showbirthday) $nav.=''; +if ($pid) $nav.=''; +if ($type) $nav.=''; +if ($usergroup) $nav.=''; $nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); $nav.=' '; $nav.='
    '; @@ -159,6 +170,7 @@ if ($socid) $param.="&socid=".$socid; if ($showbirthday) $param.="&showbirthday=1"; if ($pid) $param.="&projectid=".$pid; if ($type) $param.="&type=".$type; +if ($usergroup) $param.="&usergroup=".$usergroup; $sql = "SELECT s.nom as societe, s.rowid as socid, s.client,"; $sql.= " a.id, a.datep as dp, a.datep2 as dp2,"; @@ -203,11 +215,13 @@ if ($filtera > 0 || $filtert > 0 || $filterd > 0 || $usergroup > 0) if ($usergroup > 0) $sql.= ($filtera>0||$filtert>0||$filterd>0?" OR ":"")." ugu.fk_usergroup = ".$usergroup; $sql.= ")"; } -if ($dateselect > 0) $sql.= " AND a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'"; +// The second or of next test is to take event with no end date (we suppose duration is 1 hour in such case) +if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect-3600)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'))"; if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'"; if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); + //print $sql; dol_syslog("comm/action/listactions.php", LOG_DEBUG); diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 267f205a671..7ef2f3bd4c9 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -602,16 +602,15 @@ else if ($action == 'addline' && $user->rights->propal->creer) { // Set if we used free entry or predefined product $predef=''; $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); + $price_ht = GETPOST('price_ht'); if (GETPOST('prod_entry_mode') == 'free') { $idprod=0; - $price_ht = GETPOST('price_ht'); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); } else { $idprod=GETPOST('idprod', 'int'); - $price_ht = ''; $tva_tx = ''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index a6abf123653..f20201ee5cc 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -523,16 +523,15 @@ else if ($action == 'addline' && $user->rights->commande->creer) { // Set if we used free entry or predefined product $predef=''; $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); + $price_ht = GETPOST('price_ht'); if (GETPOST('prod_entry_mode') == 'free') { $idprod=0; - $price_ht = GETPOST('price_ht'); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); } else { $idprod=GETPOST('idprod', 'int'); - $price_ht = ''; $tva_tx = ''; } @@ -1391,7 +1390,7 @@ if ($action == 'create' && $user->rights->commande->creer) { $form->select_comptes($fk_account, 'fk_account', 0, '', 1); print ''; } - + // Delivery delay print '' . $langs->trans('AvailabilityPeriod') . ''; $form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1); @@ -1993,7 +1992,7 @@ if ($action == 'create' && $user->rights->commande->creer) { // Bank Account if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled)) - { + { print ''; print ''; print ''; } - + // Total HT print ''; print ''; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 95e330cd4e6..a1f118bf230 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -676,12 +676,13 @@ class Commande extends CommonOrder $sql.= ", entity"; $sql.= ")"; $sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id; - $sql.= ", ".($this->fk_project?$this->fk_project:"null"); + $sql.= ", ".($this->fk_project>0?$this->fk_project:"null"); $sql.= ", '".$this->db->idate($date)."'"; $sql.= ", ".($this->source>=0 && $this->source != '' ?$this->source:'null'); $sql.= ", '".$this->db->escape($this->note_private)."'"; $sql.= ", '".$this->db->escape($this->note_public)."'"; - $sql.= ", '".$this->db->escape($this->ref_client)."'"; + $sql.= ", ".($this->ref_ext?"'".$this->db->escape($this->ref_ext)."'":"null"); + $sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null"); $sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null"); $sql.= ", '".$this->modelpdf."'"; $sql.= ", ".($this->cond_reglement_id>0?"'".$this->cond_reglement_id."'":"null"); diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 9f104180def..373671fc89e 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -1115,16 +1115,15 @@ else if ($action == 'addline' && $user->rights->facture->creer) // Set if we used free entry or predefined product $predef=''; $product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):''); + $price_ht = GETPOST('price_ht'); if (GETPOST('prod_entry_mode') == 'free') { $idprod=0; - $price_ht = GETPOST('price_ht'); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); } else { $idprod=GETPOST('idprod', 'int'); - $price_ht = ''; $tva_tx = ''; } @@ -1766,8 +1765,8 @@ if ($action == 'create') $projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : ''); $ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); $ref_int = (! empty($objectsrc->ref_int) ? $objectsrc->ref_int : ''); - - // only if socid is not filled + + // only if socid not filled else it's allready done upper if (empty($socid)) $soc = $objectsrc->thirdparty; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 04a1f9c4f60..42542e43a9c 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -422,7 +422,6 @@ class Paiement extends CommonObject $totalamount=$this->amount; if (empty($totalamount)) $totalamount=$this->total; // For backward compatibility - if ($mode == 'payment') $totalamount=$totalamount; if ($mode == 'payment_supplier') $totalamount=-$totalamount; // Insert payment into llx_bank diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 16652327ef3..c0dcff6d5c3 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -60,7 +60,7 @@ if (isset($_GET["modetax"])) $modetax=$_GET["modetax"]; * * @param DoliDB $db Database handler * @param string $sql SQL Request - * @param date $date Date + * @param string $date Date * @return void */ function pt ($db, $sql, $date) diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 32adc4b87c9..67147a6d06b 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -43,10 +43,10 @@ $dolibarr_main_document_root=''; // You can put several values, separated by a coma, but number of entries must match // number of entries into $dolibarr_main_document_root_alt. // Examples: -// $dolibarr_main_url_root_alt='/extensions'; +// $dolibarr_main_url_root_alt='/custom'; // $dolibarr_main_url_root_alt='/extensions1,/extensions2'; // -$dolibarr_main_url_root_alt=''; +//$dolibarr_main_url_root_alt='/custom'; // dolibarr_main_document_root_alt @@ -55,10 +55,10 @@ $dolibarr_main_url_root_alt=''; // You can put several values, separated by a coma, but number of entries must match // number of entries into $dolibarr_main_url_root_alt. // Examples: -// $dolibarr_main_document_root_alt='/var/www/dolibarr/htdocs/extensions'; +// $dolibarr_main_document_root_alt='/var/www/dolibarr/htdocs/custom'; // $dolibarr_main_document_root_alt='C:/My web sites/dolibarr/htdocs/extensions1,C:/My web sites/dolibarr/htdocs/extensions2'; // -$dolibarr_main_document_root_alt=''; +//$dolibarr_main_document_root_alt='/var/www/dolibarr/htdocs/custom'; // dolibarr_main_data_root diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 957e20590d7..4770ff10e50 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -7,6 +7,7 @@ * Copyright (C) 2013 Christophe Battarel * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Ferran Marcet + * Copyright (C) 2014 Marcos García * * 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 @@ -718,19 +719,25 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra setEventMessage($object->error,'errors'); } } elseif ($action=='setref_supplier') { - $result = $object->fetch($id); - if ($result < 0) { - setEventMessage($object->errors,'errors'); - } - $object->ref_supplier=GETPOST('ref_supplier','alpha'); - $result = $object->update($user); - if ($result < 0) { - setEventMessage($object->errors,'errors'); - $action='editref_supplier'; - } else { - header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); - exit; + $cancelbutton = GETPOST('cancel'); + + if (!$cancelbutton) { + + $result = $object->fetch($id); + if ($result < 0) { + setEventMessage($object->errors, 'errors'); + } + $object->ref_supplier = GETPOST('ref_supplier', 'alpha'); + + $result = $object->update($user); + if ($result < 0) { + setEventMessage($object->errors, 'errors'); + $action = 'editref_supplier'; + } else { + header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); + exit; + } } } elseif ($action=='setref') { $object->ref=GETPOST('ref','alpha'); @@ -1229,8 +1236,10 @@ else /* * Lines of contracts */ - $productstatic=new Product($db); + if ($conf->product->enabled) { + $productstatic=new Product($db); + } $usemargins=0; if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1; @@ -1672,7 +1681,7 @@ else } // Form to add new line - if ($user->rights->contrat->creer && ($object->statut >= 0)) + if ($user->rights->contrat->creer && ($object->statut == 0)) { $dateSelector=1; diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 4cb2f9ec7d1..bbba602fa02 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -49,34 +49,144 @@ class Contrat extends CommonObject */ protected $table_ref_field = 'ref'; + /** + * Id of the contract + * @var int + */ var $id; + + /** + * Reference of the contract + * @var string + */ var $ref; + + /** + * External reference of the contract. + * Used by 3rd party services + * @var string + */ var $ref_ext; + + /** + * Supplier reference of the contract + * @var string + */ var $ref_supplier; + + /** + * Client id linked to the contract + * @var int + */ var $socid; var $societe; // Objet societe + + /** + * Status of the contract + * @var int + */ var $statut=0; // 0=Draft, var $product; + /** + * TODO: Which is the correct one? + * Author of the contract + * @var + */ var $user_author; - var $date_creation; // date of creation - var $date_validation; // date of last update - var $date_contrat; // date when contract was signed - var $date_cloture; // deprecated (we close contract lines, not a contract) + /** + * TODO: Which is the correct one? + * Author of the contract + * @var User + */ + public $user_creation; + + /** + * TODO: Which is the correct one? + * Author of the contract + * @var int + */ + public $fk_user_author; + + /** + * TODO: Which is the correct one? + * Author of the contract + * @var int + */ + public $user_author_id; + + /** + * @var User + */ + public $user_cloture; + + /** + * Date of creation + * @var int + */ + var $date_creation; + + /** + * Date of last modification + * Not filled until you call ->info() + * @var int + */ + public $date_modification; + + /** + * Date of validation + * @var int + */ + var $date_validation; + + /** + * Date when contract was signed + * @var int + */ + var $date_contrat; + + /** + * Date of contract closure + * @var int + * @deprecated we close contract lines, not a contract + */ + var $date_cloture; var $commercial_signature_id; var $commercial_suivi_id; - var $note; // deprecated + /** + * @deprecated Use note_private or note_public instead + */ + var $note; + + /** + * Private note + * @var string + */ var $note_private; + + /** + * Public note + * @var string + */ var $note_public; var $modelpdf; + /** + * @deprecated Use fk_project instead + */ var $fk_projet; + public $fk_project; + var $extraparams=array(); + /** + * Contract lines + * @var ContratLigne[] + */ var $lines=array(); @@ -143,8 +253,8 @@ class Contrat extends CommonObject * * @param User $user Objet User qui active le contrat * @param int $line_id Id de la ligne de detail a activer - * @param timestamp $date Date d'ouverture - * @param timestamp $date_end Date fin prevue + * @param int $date Date d'ouverture + * @param int|string $date_end Date fin prevue * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ @@ -190,7 +300,7 @@ class Contrat extends CommonObject * * @param User $user Objet User qui active le contrat * @param int $line_id Id de la ligne de detail a activer - * @param timestamp $date_end Date fin + * @param int $date_end Date fin * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ @@ -441,7 +551,9 @@ class Contrat extends CommonObject $this->ref_ext = $result["ref_ext"]; $this->statut = $result["statut"]; $this->mise_en_service = $this->db->jdate($result["datemise"]); + $this->date_contrat = $this->db->jdate($result["datecontrat"]); + $this->date_creation = $this->db->jdate($result["datecontrat"]); $this->user_author_id = $result["fk_user_author"]; @@ -470,6 +582,18 @@ class Contrat extends CommonObject $extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true); $this->fetch_optionals($this->id,$extralabels); + /* + * Lines + */ + + $this->lines = array(); + + $result=$this->fetch_lines(); + if ($result < 0) + { + $this->error=$this->db->error(); + return -3; + } return $this->id; } @@ -492,7 +616,7 @@ class Contrat extends CommonObject /** * Load lignes array into this->lines * - * @return Array Return array of contract lines + * @return ContratLigne[] Return array of contract lines */ function fetch_lines() { @@ -1097,16 +1221,16 @@ class Contrat extends CommonObject * @param float $txlocaltax2 Local tax 2 rate * @param int $fk_product Id produit * @param float $remise_percent Pourcentage de remise de la ligne - * @param timestamp $date_start Date de debut prevue - * @param timestamp $date_end Date de fin prevue - * @param float $price_base_type HT or TTC + * @param int $date_start Date de debut prevue + * @param int $date_end Date de fin prevue + * @param string $price_base_type HT or TTC * @param float $pu_ttc Prix unitaire TTC * @param int $info_bits Bits de type de lignes * @param int $fk_fournprice Fourn price id * @param int $pa_ht Buying price HT * @return int <0 si erreur, >0 si ok */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0) { global $user, $langs, $conf, $mysoc; @@ -1254,20 +1378,20 @@ class Contrat extends CommonObject * @param float $pu Prix unitaire * @param int $qty Quantite * @param float $remise_percent Pourcentage de remise de la ligne - * @param timestamp $date_start Date de debut prevue - * @param timestamp $date_end Date de fin prevue + * @param int $date_start Date de debut prevue + * @param int $date_end Date de fin prevue * @param float $tvatx Taux TVA * @param float $localtax1tx Local tax 1 rate * @param float $localtax2tx Local tax 2 rate - * @param timestamp $date_debut_reel Date de debut reelle - * @param timestamp $date_fin_reel Date de fin reelle - * @param float $price_base_type HT or TTC + * @param int|string $date_debut_reel Date de debut reelle + * @param int|string $date_fin_reel Date de fin reelle + * @param string $price_base_type HT or TTC * @param int $info_bits Bits de type de lignes * @param int $fk_fournprice Fourn price id * @param int $pa_ht Buying price HT * @return int < 0 si erreur, > 0 si ok */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0, $localtax2tx=0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0) + function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0) { global $user, $conf, $langs, $mysoc; @@ -1304,7 +1428,7 @@ class Contrat extends CommonObject $localtaxes_type=getLocalTaxesFromRate($tvatx, 0, $this->societe, $mysoc); - $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtaxtx1, $txlocaltaxtx2, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type); + $tabprice=calcul_price_total($qty, $pu, $remise_percent, $tvatx, $localtax1tx, $localtax2tx, 0, $price_base_type, $info_bits, 1, '', $localtaxes_type); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; $total_ttc = $tabprice[2]; @@ -1317,19 +1441,19 @@ class Contrat extends CommonObject // TODO A virer // Anciens indicateurs: $price, $remise (a ne plus utiliser) $remise = 0; - $price = price2num(round($pu_ht, 2)); + $price = price2num(round($pu, 2)); if (dol_strlen($remise_percent) > 0) { - $remise = round(($pu_ht * $remise_percent / 100), 2); - $price = $pu_ht - $remise; + $remise = round(($pu * $remise_percent / 100), 2); + $price = $pu - $remise; } if (empty($pa_ht)) $pa_ht=0; // si prix d'achat non renseigne et utilise pour calcul des marges alors prix achat = prix vente if ($pa_ht == 0) { - if ($pu_ht > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) - $pa_ht = $pu_ht * (1 - $remise_percent / 100); + if ($pu > 0 && (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)) + $pa_ht = $pu * (1 - $remise_percent / 100); } $sql = "UPDATE ".MAIN_DB_PREFIX."contratdet set description='".$this->db->escape($desc)."'"; @@ -1445,6 +1569,7 @@ class Contrat extends CommonObject * * @param User $user Object user * @return int <0 if KO, >0 if OK + * @deprecated This function will never be used. Status of a contract is status of its lines. */ function update_statut($user) { @@ -1862,7 +1987,6 @@ class Contrat extends CommonObject while ($xnbp < $nbp) { $line=new ContratLigne($this->db); - $line->desc=$langs->trans("Description")." ".$xnbp; $line->qty=1; $line->subprice=100; $line->price=100; @@ -1932,6 +2056,13 @@ class ContratLigne extends CommonObject var $fk_product; var $statut; // 0 inactive, 4 active, 5 closed var $label; + + /** + * @var string + * @deprecated Use $label instead + */ + public $libelle; + var $description; var $date_commande; var $date_ouverture_prevue; // date start planned @@ -1949,6 +2080,13 @@ class ContratLigne extends CommonObject var $fk_remise_except; var $subprice; // Unit price HT + + /** + * @var float + * @deprecated Use $price_ht instead + */ + public $price; + var $price_ht; var $total_ht; @@ -2331,7 +2469,7 @@ class ContratLigne extends CommonObject $sql.= ",total_localtax1=".price2num($this->total_localtax1,'MT').""; $sql.= ",total_localtax2=".price2num($this->total_localtax2,'MT').""; $sql.= ",total_ttc=".price2num($this->total_ttc,'MT').""; - $sql.= " WHERE rowid = ".$this->rowid; + $sql.= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update_total", LOG_DEBUG); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 40e177404f9..49de1529321 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -131,7 +131,6 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; $replyto = $_POST['replytoname']. ' <' . $_POST['replytomail'].'>'; $message = $_POST['message']; - $sendtocc = $sendtocc; $sendtobcc= GETPOST('sendtoccc'); if ($mode == 'emailfromproposal') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO); if ($mode == 'emailfromorder') $sendtobcc = (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)?'':$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 26f209ed107..fbf5363b753 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -388,7 +388,7 @@ abstract class CommonDocGenerator $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true); $object->fetch_optionals($object->id,$extralabels); - $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key=$array_key,$outputlangs); + $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); } return $resarray; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0dedb135298..183fed325be 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -57,6 +57,9 @@ abstract class CommonObject public $array_options=array(); + /** + * @var Societe + */ public $thirdparty; public $linkedObjectsIds; // Loaded by ->fetchObjectLinked @@ -2119,24 +2122,23 @@ abstract class CommonObject dol_syslog(get_class($this)."::setStatut", LOG_DEBUG); if ($this->db->query($sql)) { - if (! $error) - { - $trigkey=''; - if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED'; - if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED'; + $error = 0; - if ($trigkey) - { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($this->db); - $result=$interface->run_triggers($trigkey,$this,$user,$langs,$conf); - if ($result < 0) { - $error++; $this->errors=$interface->errors; - } - // Fin appel triggers - } - } + $trigkey=''; + if ($this->element == 'fichinter' && $status == 2) $trigkey='FICHINTER_CLASSIFY_BILLED'; + if ($this->element == 'fichinter' && $status == 1) $trigkey='FICHINTER_CLASSIFY_UNBILLED'; + + if ($trigkey) + { + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($this->db); + $result=$interface->run_triggers($trigkey,$this,$user,$langs,$conf); + if ($result < 0) { + $error++; $this->errors=$interface->errors; + } + // Fin appel triggers + } if (! $error) { diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 491e590403c..46e99ba272e 100755 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4351,7 +4351,7 @@ class Form * @param string $morehtmlref Code html supplementaire a afficher apres ref * @param string $moreparam More param to add in nav link url. * @param int $nodbprefix Do not include DB prefix to forge table name - * @return tring Portion HTML avec ref + boutons nav + * @return string Portion HTML avec ref + boutons nav */ function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0) { diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 4b9401498d7..d2c6ce4bd4f 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -169,7 +169,7 @@ function convertTime2Seconds($iHours=0,$iMinutes=0,$iSeconds=0) * @param string $format Output format (all: total delay days hour:min like "2 days 12:30"", allhourmin: total delay hours:min like "60:30", allhour: total delay hours without min/sec like "60:30", fullhour: total delay hour decimal like "60.5" for 60:30, hour: only hours part "12", min: only minutes part "30", sec: only seconds part, month: only month part, year: only year part); * @param int $lengthOfDay Length of day (default 86400 seconds for 1 day, 28800 for 8 hour) * @param int $lengthOfWeek Length of week (default 7) - * @return sTime Formated text of duration + * @return string Formated text of duration * Example: 0 return 00:00, 3600 return 1:00, 86400 return 1d, 90000 return 1 Day 01:00 */ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8b3b15ee86b..990c30c0f60 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1342,11 +1342,11 @@ function dol_print_email($email,$cid=0,$socid=0,$addlink=0,$max=64,$showinvalid= * Show Skype link * * @param string $skype Skype to show (only skype, without 'Name of recipient' before) - * @param int $cid Id of contact if known - * @param int $socid Id of third party if known - * @param int $addlink 0=no link to create action - * @param int $max Max number of characters to show - * @return string HTML Link + * @param int $cid Id of contact if known + * @param int $socid Id of third party if known + * @param int $addlink 0=no link to create action + * @param int $max Max number of characters to show + * @return string HTML Link */ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64) { @@ -1361,12 +1361,12 @@ function dol_print_skype($skype,$cid=0,$socid=0,$addlink=0,$max=64) $newskype=''; - $newskype.=''; - $newskype.='   '; + $newskype.='    '; - $newskype.=''; - $newskype.=' '; + $newskype.=''; + $newskype.=''; if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { diff --git a/htdocs/core/menus/init_menu_auguria.sql b/htdocs/core/menus/init_menu_auguria.sql index 7acce783e39..2758ff5ecbd 100644 --- a/htdocs/core/menus/init_menu_auguria.sql +++ b/htdocs/core/menus/init_menu_auguria.sql @@ -187,26 +187,28 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2303__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/clients.php?leftmenu=tax_vat', 'ReportByCustomers', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 2, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->tax->enabled && empty($conf->global->TAX_DISABLE_VAT_MENUS) && $leftmenu=="tax_vat"', __HANDLER__, 'left', 2304__+MAX_llx_menu__, 'accountancy', '', 2300__+MAX_llx_menu__, '/compta/tva/quadri_detail.php?leftmenu=tax_vat', 'ReportByQuarter', 2, 'companies', '$user->rights->tax->charges->lire', '', 0, 3, __ENTITY__); -- Ventilation (accounting) -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'ventil', 6__+MAX_llx_menu__, '/compta/ventilation/index.php?leftmenu=ventil', 'Ventilation', 0, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 8, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/compta/ventilation/list.php', 'ToDispatch', 1, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/compta/ventilation/lignes.php', 'Dispatched', 1, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2403__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/compta/param/', 'Setup', 1, 'companies', '$user->rights->compta->ventilation->parametrer', '', 0, 2, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2404__+MAX_llx_menu__, 'accountancy', '', 2403__+MAX_llx_menu__, '/compta/param/comptes/list.php', 'List', 2, 'companies', '$user->rights->compta->ventilation->parametrer', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2405__+MAX_llx_menu__, 'accountancy', '', 2403__+MAX_llx_menu__, '/compta/param/comptes/card.php?action=create', 'New', 2, 'companies', '$user->rights->compta->ventilation->parametrer', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2406__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/compta/export/', 'Export', 1, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 3, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2407__+MAX_llx_menu__, 'accountancy', '', 2406__+MAX_llx_menu__, '/compta/export/index.php', 'New', 2, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $conf->global->FACTURE_VENTILATION', __HANDLER__, 'left', 2408__+MAX_llx_menu__, 'accountancy', '', 2406__+MAX_llx_menu__, '/compta/export/list.php', 'List', 2, 'companies', '$user->rights->compta->ventilation->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2400__+MAX_llx_menu__, 'accountancy', 'ventil_customer', 6__+MAX_llx_menu__, '/accountancy/customer/index.php?leftmenu=ventil_customer', 'CustomersVentilation', 0, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 8, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ventil_customer"', __HANDLER__, 'left', 2401__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/accountancy/customer/list.php', 'ToDispatch', 1, 'accountancy', '$user->rights->accounting->ventilation->dispatch', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="ventil_customer"', __HANDLER__, 'left', 2402__+MAX_llx_menu__, 'accountancy', '', 2400__+MAX_llx_menu__, '/accountancy/customer/lines.php', 'Dispatched', 1, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 1, __ENTITY__); + +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled', __HANDLER__, 'left', 2410__+MAX_llx_menu__, 'accountancy', 'ventil_supplier', 6__+MAX_llx_menu__, '/accountancy/supplier/index.php?leftmenu=ventil_supplier', 'SuppliersVentilation', 0, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 9, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="ventil_supplier"', __HANDLER__, 'left', 2411__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/list.php', 'ToDispatch', 1, 'accountancy', '$user->rights->accounting->ventilation->dispatch', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $conf->fournisseur->enabled && $leftmenu=="ventil_supplier"', __HANDLER__, 'left', 2412__+MAX_llx_menu__, 'accountancy', '', 2410__+MAX_llx_menu__, '/accountancy/supplier/lines.php', 'Dispatched', 1, 'accountancy', '$user->rights->accounting->ventilation->read', '', 0, 1, __ENTITY__); -- Rapports insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2700__+MAX_llx_menu__, 'accountancy', 'ca', 6__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca&mainmenu=accountancy', 'Reportings', 0, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 11, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2702__+MAX_llx_menu__, 'accountancy', '', 2701__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2703__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2704__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/sellsjournal.php?leftmenu=ca', 'SellsJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); -insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/purchasesjournal.php?leftmenu=ca', 'PurchasesJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); --- Fiscal year +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2701__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/resultat/index.php?leftmenu=ca', 'ReportInOut', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2702__+MAX_llx_menu__, 'accountancy', '', 2701__+MAX_llx_menu__, '/compta/resultat/clientfourn.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2703__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/stats/index.php?leftmenu=ca', 'ReportTurnover', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2704__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/casoc.php?leftmenu=ca', 'ByCompanies', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2705__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyuser.php?leftmenu=ca', 'ByUsers', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled || $conf->accounting->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2708__+MAX_llx_menu__, 'accountancy', '', 2703__+MAX_llx_menu__, '/compta/stats/cabyprodserv.php?leftmenu=ca', 'ByProductsAndServices', 2, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2706__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/sellsjournal.php?leftmenu=ca', 'SellsJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->comptabilite->enabled && $leftmenu=="ca"', __HANDLER__, 'left', 2707__+MAX_llx_menu__, 'accountancy', '', 2700__+MAX_llx_menu__, '/compta/journal/purchasesjournal.php?leftmenu=ca', 'PurchasesJournal', 1, 'main', '$user->rights->compta->resultat->lire || $user->rights->accounting->comptarapport->lire', '', 0, 1, __ENTITY__); +-- Book Keeping +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled', __HANDLER__, 'left', 2720__+MAX_llx_menu__, 'accountancy', 'bookkeeping', 6__+MAX_llx_menu__, '/accountancy/bookkeeping/list.php?leftmenu=bookkeeping', 'Bookkeeping', 0, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 12, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2721__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/listbyyear.php', 'ByYear', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 0, __ENTITY__); +insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled && $leftmenu=="bookkeeping"', __HANDLER__, 'left', 2722__+MAX_llx_menu__, 'accountancy', '', 2720__+MAX_llx_menu__, '/accountancy/bookkeeping/balancebymonth.php', 'AccountBalanceByMonth', 1, 'accountancy', '$user->rights->accounting->mouvements->lire', '', 0, 1, __ENTITY__); +-- Fiscal year & Chart of accounts insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled"', __HANDLER__, 'left', 2750__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/fiscalyear.php?leftmenu=setup', 'Fiscalyear', 1, 'main', '$user->rights->accounting->fiscalyear', '', 2, 20, __ENTITY__); insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$conf->accounting->enabled"', __HANDLER__, 'left', 2751__+MAX_llx_menu__, 'home', '', 6__+MAX_llx_menu__, '/accountancy/admin/account.php?mainmenu=accountancy', 'Chartofaccounts', 1, 'main', '$user->rights->accounting->chartofaccount', '', 2, 21, __ENTITY__); -- Check deposit diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 8d5cc637898..e0f1e1b05d9 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -273,6 +273,42 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM else dol_print_error($db); $db->free($resql); } + + if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account + { + $newmenu->add('/accountancy/journal/index.php?leftmenu=journal',$langs->trans("Journaux"),0,$user->rights->banque->lire); + + if ($leftmenu == 'journal') + { + $sql = "SELECT rowid, label, accountancy_journal"; + $sql.= " FROM ".MAIN_DB_PREFIX."bank_account"; + $sql.= " WHERE entity = ".$conf->entity; + $sql.= " AND clos = 0"; + $sql.= " ORDER BY label"; + + $resql = $db->query($sql); + if ($resql) + { + $numr = $db->num_rows($resql); + $i = 0; + + if ($numr > 0) + + while ($i < $numr) + { + $objp = $db->fetch_object($resql); + $newmenu->add('/accountancy/journal/bankjournal.php?id_account='.$objp->rowid,$langs->trans("Journal").' - '.$objp->label,1,$user->rights->accounting->comptarapport->lire); + $i++; + } + } + else dol_print_error($db); + $db->free($resql); + + // Add other journal + $newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=journal",$langs->trans("SellsJournal"),1,$user->rights->accounting->comptarapport->lire); + $newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=journal",$langs->trans("PurchasesJournal"),1,$user->rights->accounting->comptarapport->lire); + } + } if ($conf->ftp->enabled && $mainmenu == 'ftp') // Entry for FTP { diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index be686377ce3..46364b23d0d 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -239,29 +239,9 @@ class pdf_strato extends ModelePDFContract $iniY = $tab_top + 7; $curY = $tab_top + 7; - $nexY = $tab_top + 7; + $nexY = $tab_top + 2; $pdf->SetXY($this->marge_gauche, $tab_top); - $pdf->MultiCell(190,8,$outputlangs->transnoentities("Description"),0,'L',0); - $pdf->line($this->marge_gauche, $tab_top + 8, $this->page_largeur-$this->marge_droite, $tab_top + 8); - - $pdf->SetFont('', '', $default_font_size - 1); - - $pdf->MultiCell(0, 3, ''); // Set interline to 3 - $pdf->SetXY($this->marge_gauche, $tab_top + 8); - $text=$object->description; - if ($object->duree > 0) - { - $totaltime=convertSecondToTime($object->duree,'all',$conf->global->MAIN_DURATION_OF_WORKDAY); - $text.=($text?' - ':'').$langs->trans("Total").": ".$totaltime; - } - $desc=dol_htmlentitiesbr($text,1); - //print $outputlangs->convToOutputCharset($desc); exit; - - $pdf->writeHTMLCell(180, 3, 10, $tab_top + 8, $outputlangs->convToOutputCharset($desc), 0, 1); - $nexY = $pdf->GetY(); - - $pdf->line($this->marge_gauche, $nexY, $this->page_largeur-$this->marge_droite, $nexY); $pdf->MultiCell(0, 2, ''); // Set interline to 3. Then writeMultiCell must use 3 also. @@ -285,7 +265,20 @@ class pdf_strato extends ModelePDFContract $pageposbefore=$pdf->getPage(); // Description of product line - $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true)." - ".$outputlangs->transnoentities("Duration")." : ".convertSecondToTime($objectligne->duration),1,$outputlangs->charset_output).''; + + if ($objectligne->datei) { + $datei = dol_print_date($objectligne->datei,'dayhour',false,$outputlangs,true); + } else { + $datei = $langs->trans("Unknown"); + } + + if ($objectligne->duration) { + $durationi = convertSecondToTime($objectligne->duration); + } else { + $durationi = $langs->trans("Unknown"); + } + + $txt=''.dol_htmlentitiesbr($outputlangs->transnoentities("Date")." : ".$datei." - ".$outputlangs->transnoentities("Duration")." : ".$durationi,1,$outputlangs->charset_output).''; $desc=dol_htmlentitiesbr($objectligne->desc,1); $pdf->writeHTMLCell(0, 0, $curX, $curY, dol_concatdesc($txt,$desc), 0, 1, 0); @@ -533,7 +526,7 @@ class pdf_strato extends ModelePDFContract $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->datec,"day",false,$outputlangs,true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_creation,"day",false,$outputlangs,true), '', 'R'); if ($object->client->code_client) { diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 1364aeff65e..f19d8a0e3a0 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -138,7 +138,7 @@ class doc_generic_project_odt extends ModelePDFProjects $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true); $object->fetch_optionals($object->id,$extralabels); - $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key=$array_key,$outputlangs); + $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); } return $resarray; diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 7f93851cc65..c074cba31e5 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -139,7 +139,7 @@ class doc_generic_task_odt extends ModelePDFTask $extralabels = $extrafields->fetch_name_optionals_label($extrafieldkey,true); $object->fetch_optionals($object->id,$extralabels); - $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key=$array_key,$outputlangs); + $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); } return $resarray; diff --git a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql index 0b71a2fe6fe..ad05f850e16 100755 --- a/htdocs/install/mysql/migration/3.6.0-3.7.0.sql +++ b/htdocs/install/mysql/migration/3.6.0-3.7.0.sql @@ -1145,5 +1145,5 @@ ALTER TABLE llx_facturedet_rec ADD COLUMN fk_contract_line integer NULL; ALTER TABLE llx_resource MODIFY COLUMN entity integer DEFAULT 1 NOT NULL; -- This request make mysql drop (mysql bug, so we add it at end): ---ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type(rowid); +ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type(rowid); diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 9b81f0ca78d..9e1ca7bb6f9 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -115,7 +115,7 @@ ALTER TABLE llx_product_fournisseur_price DROP FOREIGN KEY fk_product_fournisseu -- Fix: deprecated tag to new one update llx_opensurvey_sondage set format = 'D' where format = 'D+'; update llx_opensurvey_sondage set format = 'A' where format = 'A+'; - +update llx_opensurvey_sondage set tms = now(); -- ALTER TABLE llx_facture_fourn ALTER COLUMN fk_cond_reglement DROP NOT NULL; diff --git a/htdocs/install/mysql/tables/llx_c_departements.key.sql b/htdocs/install/mysql/tables/llx_c_departements.key.sql index 427d031a705..66194440610 100644 --- a/htdocs/install/mysql/tables/llx_c_departements.key.sql +++ b/htdocs/install/mysql/tables/llx_c_departements.key.sql @@ -21,5 +21,8 @@ ALTER TABLE llx_c_departements ADD UNIQUE uk_departements (code_departement,fk_r ALTER TABLE llx_c_departements ADD INDEX idx_departements_fk_region (fk_region); +-- NOTE: We duplicate creation of unique keys on llx_c_regions NOW to be able to create foreign keys. +ALTER TABLE llx_c_regions ADD UNIQUE INDEX uk_code_region (code_region); + ALTER TABLE llx_c_departements ADD CONSTRAINT fk_departements_fk_region FOREIGN KEY (fk_region) REFERENCES llx_c_regions (code_region); diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 09f0d507a39..d5fa016e02a 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -1523,7 +1523,7 @@ function migrate_price_contrat($db,$langs,$conf) // On met a jour les 3 nouveaux champs $contratligne= new ContratLigne($db); //$contratligne->fetch($rowid); Non requis car le update_total ne met a jour que chp redefinis - $contratligne->rowid=$rowid; + $contratligne->id=$rowid; $result=calcul_price_total($qty,$pu,$remise_percent,$txtva,0,0,0,'HT',$info_bits,0,$tmpmysoc); $total_ht = $result[0]; @@ -3634,137 +3634,170 @@ function migrate_delete_old_dir($db,$langs,$conf) * We must do this when internal menu of module or permissions has changed * or when triggers have moved. * - * @param DoliDB $db Database handler - * @param Translate $langs Object langs - * @param Conf $conf Object conf + * @param DoliDB $db Database handler + * @param Translate $langs Object langs + * @param Conf $conf Object conf + * @param array $listofmodule List of modules * @return void */ -function migrate_reload_modules($db,$langs,$conf) +function migrate_reload_modules($db,$langs,$conf,$listofmodule=array()) { dolibarr_install_syslog("upgrade2::migrate_reload_modules"); - if (! empty($conf->global->MAIN_MODULE_AGENDA)) + // Module to reload if no info is provided + if (count($listofmodule) == 0) { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Agenda"); - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modAgenda.class.php'; - if ($res) { - $mod=new modAgenda($db); - $mod->remove('noboxes'); - $mod->init('newboxdefonly'); - } - } - if (! empty($conf->global->MAIN_MODULE_SOCIETE)) - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Societe"); - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modSociete.class.php'; - if ($res) { - $mod=new modSociete($db); - $mod->remove('noboxes'); - $mod->init('newboxdefonly'); - } - } - if (! empty($conf->global->MAIN_MODULE_PRODUIT)) // Permission has changed into 2.7 - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Produit"); - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modProduct.class.php'; - if ($res) { - $mod=new modProduct($db); - //$mod->remove('noboxes'); - $mod->init('newboxdefonly'); - } - } - if (! empty($conf->global->MAIN_MODULE_SERVICE)) // Permission has changed into 2.7 - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Service"); - if ($res) { - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php'; - $mod=new modService($db); - //$mod->remove('noboxes'); - $mod->init('newboxdefonly'); - } - } - if (! empty($conf->global->MAIN_MODULE_COMMANDE)) // Permission has changed into 2.9 - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Commande"); - if ($res) { - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php'; - $mod=new modCommande($db); - //$mod->remove('noboxes'); - $mod->init('newboxdefonly'); - } - } - if (! empty($conf->global->MAIN_MODULE_FACTURE)) // Permission has changed into 2.9 - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Facture"); - if ($res) { - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFacture.class.php'; - $mod=new modFacture($db); - //$mod->remove('noboxes'); - $mod->init('newboxdefonly'); - } - } - if (! empty($conf->global->MAIN_MODULE_FOURNISSEUR)) // Permission has changed into 2.9 - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Fournisseur"); - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php'; - if ($res) { - $mod=new modFournisseur($db); - //$mod->remove('noboxes'); - $mod->init('newboxdefonly'); - } + $listofmodule=array( + 'MAIN_MODULE_AGENDA', + 'MAIN_MODULE_SOCIETE', + 'MAIN_MODULE_PRODUIT', + 'MAIN_MODULE_SERVICE', + 'MAIN_MODULE_COMMANDE', + 'MAIN_MODULE_FACTURE', + 'MAIN_MODULE_FOURNISSEUR', + 'MAIN_MODULE_USER', + 'MAIN_MODULE_DEPLACEMENT', + 'MAIN_MODULE_DON', + 'MAIN_MODULE_ECM', + 'MAIN_MODULE_PAYBOX', + 'MAIN_MODULE_OPENSURVEY' + ); } - if (! empty($conf->global->MAIN_MODULE_USER)) // Permission has changed into 3.0 + foreach($listofmodule as $moduletoreload) { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module User"); - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modUser.class.php'; - if ($res) { - $mod=new modUser($db); - //$mod->remove('noboxes'); // We need to remove because id of module has changed - $mod->init('newboxdefonly'); - } - } - if (! empty($conf->global->MAIN_MODULE_DEPLACEMENT)) // Permission has changed into 3.0 - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Deplacement"); - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDeplacement.class.php'; - if ($res) { - $mod=new modDeplacement($db); - //$mod->remove('noboxes'); // We need to remove because a permission id has been removed - $mod->init('newboxdefonly'); - } - } - if (! empty($conf->global->MAIN_MODULE_DON)) // Permission has changed into 3.0 - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Don"); - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDon.class.php'; - if ($res) { - $mod=new modDon($db); - //$mod->remove('noboxes'); // We need to remove because a permission id has been removed - $mod->init('newboxdefonly'); - } - } - if (! empty($conf->global->MAIN_MODULE_ECM)) // Permission has changed into 3.0 and 3.1 - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module ECM"); - if ($res) { - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modECM.class.php'; - $mod=new modECM($db); - $mod->remove('noboxes'); // We need to remove because a permission id has been removed - $mod->init('newboxdefonly'); - } - } - if (! empty($conf->global->MAIN_MODULE_PAYBOX)) // Permission has changed into 3.0 - { - dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Paybox"); - $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modPaybox.class.php'; - if ($res) { - $mod=new modPaybox($db); - $mod->remove('noboxes'); // We need to remove because id of module has changed - $mod->init('newboxdefonly'); - } - } + if (! empty($conf->global->MAIN_MODULE_AGENDA)) + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Agenda"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modAgenda.class.php'; + if ($res) { + $mod=new modAgenda($db); + $mod->remove('noboxes'); + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_SOCIETE)) + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Societe"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modSociete.class.php'; + if ($res) { + $mod=new modSociete($db); + $mod->remove('noboxes'); + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_PRODUIT)) // Permission has changed into 2.7 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Produit"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modProduct.class.php'; + if ($res) { + $mod=new modProduct($db); + //$mod->remove('noboxes'); + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_SERVICE)) // Permission has changed into 2.7 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Service"); + if ($res) { + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php'; + $mod=new modService($db); + //$mod->remove('noboxes'); + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_COMMANDE)) // Permission has changed into 2.9 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Commande"); + if ($res) { + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php'; + $mod=new modCommande($db); + //$mod->remove('noboxes'); + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_FACTURE)) // Permission has changed into 2.9 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Facture"); + if ($res) { + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFacture.class.php'; + $mod=new modFacture($db); + //$mod->remove('noboxes'); + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_FOURNISSEUR)) // Permission has changed into 2.9 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Fournisseur"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php'; + if ($res) { + $mod=new modFournisseur($db); + //$mod->remove('noboxes'); + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_USER)) // Permission has changed into 3.0 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module User"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modUser.class.php'; + if ($res) { + $mod=new modUser($db); + //$mod->remove('noboxes'); // We need to remove because id of module has changed + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_DEPLACEMENT)) // Permission has changed into 3.0 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Deplacement"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDeplacement.class.php'; + if ($res) { + $mod=new modDeplacement($db); + //$mod->remove('noboxes'); // We need to remove because a permission id has been removed + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_DON)) // Permission has changed into 3.0 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Don"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modDon.class.php'; + if ($res) { + $mod=new modDon($db); + //$mod->remove('noboxes'); // We need to remove because a permission id has been removed + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_ECM)) // Permission has changed into 3.0 and 3.1 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module ECM"); + if ($res) { + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modECM.class.php'; + $mod=new modECM($db); + $mod->remove('noboxes'); // We need to remove because a permission id has been removed + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_PAYBOX)) // Permission has changed into 3.0 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Paybox"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modPaybox.class.php'; + if ($res) { + $mod=new modPaybox($db); + $mod->remove('noboxes'); // We need to remove because id of module has changed + $mod->init('newboxdefonly'); + } + } + if (! empty($conf->global->MAIN_MODULE_OPENSURVEY)) // Permission has changed into 3.0 + { + dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate module Opensurvey"); + $res=@include_once DOL_DOCUMENT_ROOT.'/core/modules/modOpenSurvey.class.php'; + if ($res) { + $mod=new modOpenSurvey($db); + $mod->remove('noboxes'); // We need to remove because menu entries has changed + $mod->init('newboxdefonly'); + } + } + } } diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index fd07d379a44..bfded6f40e2 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -61,6 +61,7 @@ ErrorFailedToSaveFile=Error, failed to save file. SetDate=Set date SelectDate=Select a date SeeAlso=See also %s +SeeHere=See here BackgroundColorByDefault=Default background color FileNotUploaded=The file was not uploaded FileUploaded=The file was successfully uploaded diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8d29e0f3903..b805e098706 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1,19 +1,15 @@ * Copyright (C) 2003 Xavier Dutoit - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2011-2014 Philippe Grand * Copyright (C) 2008 Matteli * Copyright (C) 2011-2013 Juanjo Menent -<<<<<<< HEAD * Copyright (C) 2012 Christophe Battarel -======= - * Copyright (C) 2012 Christophe Battarel * Copyright (C) 2014 Marcos García ->>>>>>> refs/remotes/origin/3.7 * * 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/opensurvey/card.php b/htdocs/opensurvey/card.php index a4cbc99e706..5d32db24d5c 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -373,7 +373,7 @@ print '
    '; if ($object->allow_comments) { print $langs->trans("AddACommentForPoll") . '
    '; print '
    '."\n"; - print $langs->trans("Name") .':
    '."\n"; + print $langs->trans("Name") .':
    '."\n"; print '
    '."\n"; if (isset($erreur_commentaire_vide) && $erreur_commentaire_vide=="yes") { print "" . $langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Name")) . ""; diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index fa506285cc8..b4c8570dec8 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -496,7 +496,7 @@ class Opensurveysondage extends CommonObject */ public function deleteComment($id_comment) { - $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.$id_comment.' AND id_sondage = '.$this->id_sondage; + $sql = 'DELETE FROM '.MAIN_DB_PREFIX.'opensurvey_comments WHERE id_comment = '.$id_comment.' AND id_sondage = "'.$this->db->escape($this->id_sondage).'"'; $resql = $this->db->query($sql); if (!$resql) { diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index 2cd56778f83..8c66f6157ba 100644 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -870,7 +870,12 @@ if (GETPOST("source") == 'membersubscription' && $valid) // Amount $var=!$var; print '
    '; print $langs->trans('BankAccount'); @@ -2010,7 +2009,7 @@ if ($action == 'create' && $user->rights->commande->creer) { print '
    ' . $langs->trans('AmountHT') . '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '
    '.$langs->trans("Amount"); - if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; + if (empty($amount)) + { + print ' ('.$langs->trans("ToComplete"); + if (! empty($conf->global->MEMBER_EXT_URL_SUBSCRIPTION_INFO)) print ' - '.$langs->trans("SeeHere").''; + print ')'; + } print ''; if (empty($amount) || ! is_numeric($amount)) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index b1ba3b08438..9ea4f3de9c5 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1662,7 +1662,7 @@ class User extends CommonObject /** * Add user into a group * - * @param Group $group Id of group + * @param int $group Id of group * @param int $entity Entity * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK @@ -1721,7 +1721,7 @@ class User extends CommonObject /** * Remove a user from a group * - * @param Group $group Id of group + * @param int $group Id of group * @param int $entity Entity * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK diff --git a/test/phpunit/ContratTest.php b/test/phpunit/ContratTest.php index 36724cde73e..5adf002c885 100644 --- a/test/phpunit/ContratTest.php +++ b/test/phpunit/ContratTest.php @@ -164,37 +164,13 @@ class ContratTest extends PHPUnit_Framework_TestCase return $localobject; } - /** - * testContratValid - * - * @param Contrat $localobject Contract - * @return int - * - * @depends testContratFetch - * The depends says test is run only if previous is ok - */ - public function testContratValid($localobject) - { - global $conf,$user,$langs,$db; - $conf=$this->savconf; - $user=$this->savuser; - $langs=$this->savlangs; - $db=$this->savdb; - - $result=$localobject->update_statut($user); - print __METHOD__." id=".$localobject->id." result=".$result."\n"; - - $this->assertLessThan($result, 0); - return $localobject; - } - /** - * testContratValid + * testContratOther * * @param Object $localobject Object contract * @return int * - * @depends testContratValid + * @depends testContratFetch * The depends says test is run only if previous is ok */ public function testContratOther($localobject)