diff --git a/ChangeLog b/ChangeLog index 43fecf4d2e7..9b985647586 100644 --- a/ChangeLog +++ b/ChangeLog @@ -287,7 +287,9 @@ Following changes may create regressions for some external modules, but were nec * Jquery plugin tableDnd updated. You now need to use decodeURI on the return value of tableDnDSerialize() and add 'td.' to the beginning of the dragHandle match string. * IE8 and earlier and Firefox 12 and earlier (< 2012) are no more supported. - +* The module ExpenseReport use numbering rules that you can setup (like other modules do). If you need to + keep the hard coded numbering rule of expenses report used in 6.0, just add constant + EXPENSEREPORT_USE_OLD_NUMBERING_RULE to 1. * If you use the external module "multicompany", you must also upgrade the module. Multicompany module for Dolibarr v7 is required because with Dolibarr v7, payment modes and payment conditions are management as data that are dedicated to each company. If you keep your old version of multicompany module, mode and diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 41152130f19..3e2c0840f8a 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -59,6 +59,8 @@ class AccountingJournal extends CommonObject */ function fetch($rowid = null, $journal_code = null) { + global $conf; + if ($rowid || $journal_code) { $sql = "SELECT rowid, code, label, nature, active"; @@ -66,8 +68,11 @@ class AccountingJournal extends CommonObject $sql .= " WHERE"; if ($rowid) { $sql .= " rowid = " . (int) $rowid; - } elseif ($journal_code) { + } + elseif ($journal_code) + { $sql .= " code = '" . $this->db->escape($journal_code) . "'"; + $sql .= " AND entity = " . $conf->entity; } dol_syslog(get_class($this)."::fetch sql=" . $sql, LOG_DEBUG); diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 499f9e4f46c..a67fd457e11 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -39,6 +39,8 @@ class lettering extends BookKeeping */ public function lettrageTiers($socid) { + global $conf; + $error = 0; $object = new Societe($this->db); @@ -91,7 +93,8 @@ class lettering extends BookKeeping $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiementfourn as payf ON payfacf.fk_paiementfourn=payf.rowid"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON (bk.fk_doc = payf.fk_bank AND bk.code_journal='" . $obj->code_journal . "')"; $sql .= " WHERE payfacf.fk_paiementfourn = '" . $obj->url_id . "' "; - $sql .= " AND code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4) "; + $sql .= " AND facf.entity = ".$conf->entity; + $sql .= " AND code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4 AND entity=".$conf->entity.") "; $sql .= " AND ( "; if (! empty($object->code_compta)) { $sql .= " bk.subledger_account = '" . $object->code_compta . "' "; @@ -118,7 +121,8 @@ class lettering extends BookKeeping $sql = 'SELECT bk.rowid, facf.ref, facf.ref_supplier '; $sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn facf "; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = facf.rowid AND facf.rowid IN (" . implode(',', $ids_fact) . "))"; - $sql .= " WHERE bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=3) "; + $sql .= " WHERE bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=3 AND entity=".$conf->entity.") "; + $sql .= " AND facf.entity = ".$conf->entity; $sql .= " AND ( "; if (! empty($object->code_compta)) { $sql .= " bk.subledger_account = '" . $object->code_compta . "' "; @@ -149,7 +153,8 @@ class lettering extends BookKeeping $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "paiement as pay ON payfac.fk_paiement=pay.rowid"; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON (bk.fk_doc = pay.fk_bank AND bk.code_journal='" . $obj->code_journal . "')"; $sql .= " WHERE payfac.fk_paiement = '" . $obj->url_id . "' "; - $sql .= " AND bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4) "; + $sql .= " AND bk.code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=4 AND entity=".$conf->entity.") "; + $sql .= " AND fac.entity = ".$conf->entity; $sql .= " AND ( "; if (! empty($object->code_compta)) { $sql .= " bk.subledger_account = '" . $object->code_compta . "' "; @@ -176,7 +181,8 @@ class lettering extends BookKeeping $sql = 'SELECT bk.rowid, fac.ref, fac.ref_supplier '; $sql .= " FROM " . MAIN_DB_PREFIX . "facture fac "; $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "accounting_bookkeeping as bk ON( bk.fk_doc = fac.rowid AND fac.rowid IN (" . implode(',', $ids_fact) . "))"; - $sql .= " WHERE code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=2) "; + $sql .= " WHERE code_journal IN (SELECT code FROM " . MAIN_DB_PREFIX . "accounting_journal WHERE nature=2 AND entity=".$conf->entity.") "; + $sql .= " AND fac.entity = ".$conf->entity; $sql .= " AND ( "; if (! empty($object->code_compta)) { $sql .= " bk.subledger_account = '" . $object->code_compta . "' "; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index c7aa1d80800..9e0a0d6321d 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1048,7 +1048,7 @@ class ActionComm extends CommonObject $response = new WorkboardResponse(); $response->warning_delay = $conf->agenda->warning_delay/60/60/24; $response->label = $langs->trans("ActionsToDo"); - $response->url = DOL_URL_ROOT.'/comm/action/list.php?status=todo&mainmenu=agenda'; + $response->url = DOL_URL_ROOT.'/comm/action/list.php?actioncode=0&status=todo&mainmenu=agenda'; if ($user->rights->agenda->allactions->read) $response->url.='&filtert=-1'; $response->img = img_object('',"action",'class="inline-block valigntextmiddle"'); } diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index a0e91a120f9..33f9b86a1df 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -140,6 +140,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab } } + /* * Actions */ @@ -353,15 +354,15 @@ if ($resql) print ''; print ''; $nav=''; - if ($optioncss != '') $nav.= ''; - //if ($actioncode) $nav.=''; - if ($resourceid) $nav.=''; - if ($filter) $nav.=''; - if ($filtert) $nav.=''; - if ($socid) $nav.=''; - if ($showbirthday) $nav.=''; - if ($pid) $nav.=''; - if ($usergroup) $nav.=''; + + //if ($actioncode) $nav.=''; + //if ($resourceid) $nav.=''; + if ($filter) $nav.=''; + if ($filtert) $nav.=''; + //if ($socid) $nav.=''; + if ($showbirthday) $nav.=''; + //if ($pid) $nav.=''; + //if ($usergroup) $nav.=''; print $nav; dol_fiche_head($head, $tabactive, $langs->trans('Agenda'), 0, 'action'); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index f12577fbc5f..af67bd8107b 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -41,15 +41,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -if (! empty($conf->projet->enabled)) - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -$langs->load('companies'); -$langs->load('propal'); -$langs->load('compta'); -$langs->load('bills'); -$langs->load('orders'); -$langs->load('products'); +$langs->loadLangs(array('companies','propal','compta','bills','orders','products')); $socid=GETPOST('socid','int'); @@ -141,7 +135,7 @@ $checkedtypetiers=0; $arrayfields=array( 'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'p.ref_client'=>array('label'=>$langs->trans("RefCustomer"), 'checked'=>1), - 'pr.ref'=>array('label'=>$langs->trans("Project"), 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1)), + 'pr.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>1, 'enabled'=>(empty($conf->projet->enabled)?0:1)), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), @@ -237,6 +231,7 @@ $formother = new FormOther($db); $formfile = new FormFile($db); $formpropal = new FormPropal($db); $companystatic=new Societe($db); +$projectstatic=new Project($db); $formcompany=new FormCompany($db); $help_url='EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos'; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ca6d2bc8fdd..01ea8d93de3 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -217,6 +217,7 @@ if (empty($reshook)) if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); } if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $ret = $object->fetch($id); // Reload to get new records @@ -529,6 +530,7 @@ if (empty($reshook)) if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); } $model=$object->modelpdf; $ret = $object->fetch($id); // Reload to get new records @@ -606,7 +608,6 @@ if (empty($reshook)) $result=$object->set_draft($user, $idwarehouse); if ($result<0) setEventMessages($object->error, $object->errors, 'errors'); - // Define output language if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { @@ -617,6 +618,7 @@ if (empty($reshook)) if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); } $model=$object->modelpdf; $ret = $object->fetch($id); // Reload to get new records @@ -1495,6 +1497,7 @@ if (empty($reshook)) if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); } $model=$object->modelpdf; $ret = $object->fetch($id); // Reload to get new records @@ -1747,6 +1750,7 @@ if (empty($reshook)) if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); } $desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; @@ -1770,6 +1774,7 @@ if (empty($reshook)) if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); } if (! empty($prod->customcode)) $tmptxt .= $outputlangs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode; @@ -1835,6 +1840,7 @@ if (empty($reshook)) if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); } $model=$object->modelpdf; $ret = $object->fetch($id); // Reload to get new records @@ -2012,6 +2018,7 @@ if (empty($reshook)) if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('products'); } $ret = $object->fetch($id); // Reload to get new records diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index e79e28c934a..84898930ed9 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -72,6 +72,7 @@ $search_product_category=GETPOST('search_product_category','int'); $search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha'); $search_refcustomer=GETPOST('search_refcustomer','alpha'); $search_type=GETPOST('search_type','int'); +$search_project=GETPOST('search_project','alpha'); $search_societe=GETPOST('search_societe','alpha'); $search_montant_ht=GETPOST('search_montant_ht','alpha'); $search_montant_vat=GETPOST('search_montant_vat','alpha'); @@ -151,6 +152,7 @@ $arrayfields=array( 'f.type'=>array('label'=>$langs->trans("Type"), 'checked'=>0), 'f.date'=>array('label'=>$langs->trans("DateInvoice"), 'checked'=>1), 'f.date_lim_reglement'=>array('label'=>$langs->trans("DateDue"), 'checked'=>1), + 'p.ref'=>array('label'=>$langs->trans("ProjectRef"), 'checked'=>0), 's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1), 's.town'=>array('label'=>$langs->trans("Town"), 'checked'=>1), 's.zip'=>array('label'=>$langs->trans("Zip"), 'checked'=>1), @@ -362,7 +364,8 @@ $sql.= ' f.datec as date_creation, f.tms as date_update,'; $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta as code_compta_client, s.code_compta_fournisseur,'; $sql.= " typent.code as typent_code,"; $sql.= " state.code_departement as state_code, state.nom as state_name,"; -$sql.= " country.code as country_code"; +$sql.= " country.code as country_code,"; +$sql.= " p.rowid as project_id, p.ref as project_ref"; // We need dynamount_payed to be able to sort on status (value is surely wrong because we can count several lines several times due to other left join or link with contacts. But what we need is just 0 or > 0) // TODO Better solution to be able to sort on already payed or remain to pay is to store amount_payed in a denormalized field. if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed'; @@ -381,6 +384,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab if (! $sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid'; if ($sall || $search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture'; if ($search_product_category > 0) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet"; // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_user > 0) @@ -488,7 +492,8 @@ if (! $sall) $sql.= ' s.rowid, s.nom, s.email, s.town, s.zip, s.fk_pays, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,'; $sql.= ' typent.code,'; $sql.= ' state.code_departement, state.nom,'; - $sql.= ' country.code'; + $sql.= ' country.code,'; + $sql.= " p.rowid, p.ref"; foreach ($extrafields->attribute_label as $key => $val) //prevent error with sql_mode=only_full_group_by { @@ -714,12 +719,12 @@ if ($resql) // Project if (! empty($arrayfields['p.ref']['checked'])) { - print '