diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index b7d61674fd8..aedaeda0e5b 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -117,30 +117,6 @@ if ($action == 'validatehistory') { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } -} elseif ($action == 'cleanaccountancycode') { - $error = 0; - $db->begin(); - - // Now clean - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; - $sql1.= " SET fk_code_ventilation = 0"; - $sql1.= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f"; - $sql1.= " WHERE f.datef >= '" . $db->idate($search_date_start) . "'"; - $sql1.= " AND f.datef <= '" . $db->idate($search_date_end) . "'"; - $sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")"; - $sql1.=")"; - - dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG); - - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); - } else { - $db->commit(); - setEventMessage($langs->trans('Done'), 'mesgs'); - } } @@ -183,8 +159,6 @@ print '
'; $y = $year_current; $buttonbind = '' . $langs->trans("ValidateHistory") . ''; -$buttonreset = ''; -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $buttonreset = '' . $langs->trans("CleanHistory", $year_current) . ''; print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); @@ -262,7 +236,7 @@ print ''; print '
'; -print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, ''); +print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); print '
'; print ''; diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index c4c3d03ee97..e696b4774d1 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -110,27 +110,37 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', if (is_array($changeaccount) && count($changeaccount) > 0) { $error = 0; + if (! (GETPOST('account_parent','int') >= 0)) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors'); + } + $db->begin(); - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as l"; - $sql1 .= " SET l.fk_code_ventilation=" . GETPOST('account_parent','int'); - $sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')'; + if (! $error) + { + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as l"; + $sql1 .= " SET l.fk_code_ventilation=" . (GETPOST('account_parent','int') > 0 ? GETPOST('account_parent','int') : '0'); + $sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')'; - dol_syslog('accountancy/customer/lines.php::changeaccount sql= ' . $sql1); - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - setEventMessages($db->lasterror(), null, 'errors'); - } - if (! $error) { - $db->commit(); - setEventMessages($langs->trans('Save'), null, 'mesgs'); - } else { - $db->rollback(); - setEventMessages($db->lasterror(), null, 'errors'); + dol_syslog('accountancy/customer/lines.php::changeaccount sql= ' . $sql1); + $resql1 = $db->query($sql1); + if (! $resql1) { + $error ++; + setEventMessages($db->lasterror(), null, 'errors'); + } + if (! $error) { + $db->commit(); + setEventMessages($langs->trans('Save'), null, 'mesgs'); + } else { + $db->rollback(); + setEventMessages($db->lasterror(), null, 'errors'); + } + + $account_parent = ''; // Protection to avoid to mass apply it a second time } - $account_parent = ''; // Protection to avoid to mass apply it a second time } @@ -272,7 +282,7 @@ if ($result) { print $langs->trans("DescVentilDoneCustomer") . '
'; print '
' . $langs->trans("ChangeAccount") . '
'; - print $formaccounting->select_account($account_parent, 'account_parent', 1); + print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print '
'; $moreforfilter = ''; diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 0768ee01bf8..cec7fbdced4 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -114,30 +114,6 @@ if ($action == 'validatehistory') { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } -} elseif ($action == 'cleanaccountancycode') { - $error = 0; - $db->begin(); - - // Now clean - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; - $sql1.= " SET fk_code_ventilation = 0"; - $sql1.= " WHERE erd.fk_expensereport IN ( SELECT er.rowid FROM " . MAIN_DB_PREFIX . "expensereport as er"; - $sql1.= " WHERE er.date_debut >= '" . $db->idate($search_date_start) . "'"; - $sql1.= " AND er.date_debut <= '" . $db->idate($search_date_end) . "'"; - $sql1.= " AND er.entity IN (" . getEntity('accountancy') . ")"; - $sql1.=")"; - - dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG); - - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); - } else { - $db->commit(); - setEventMessage($langs->trans('Done'), 'mesgs'); - } } @@ -180,8 +156,6 @@ print '
'; $y = $year_current; $buttonbind = '' . $langs->trans("ValidateHistory") . ''; -$buttonreset = ''; -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $buttonreset = '' . $langs->trans("CleanHistory", $year_current) . ''; print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); @@ -253,7 +227,7 @@ print ''; print '
'; -print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, ''); +print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); print '
'; diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index e00b4527818..28a44d23a5e 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -43,7 +43,7 @@ $langs->load("accountancy"); $langs->load("trips"); $langs->load("productbatch"); -$account_parent = GETPOST('account_parent'); +$account_parent = GETPOST('account_parent','int'); $changeaccount = GETPOST('changeaccount'); // Search Getpost $search_expensereport = GETPOST('search_expensereport', 'alpha'); @@ -103,27 +103,36 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', if (is_array($changeaccount) && count($changeaccount) > 0) { $error = 0; + if (! (GETPOST('account_parent','int') >= 0)) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors'); + } + $db->begin(); - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; - $sql1 .= " SET erd.fk_code_ventilation=" . GETPOST('account_parent','int'); - $sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')'; + if (! $error) + { + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "expensereport_det as erd"; + $sql1 .= " SET erd.fk_code_ventilation=" . (GETPOST('account_parent','int') > 0 ? GETPOST('account_parent','int') : '0'); + $sql1 .= ' WHERE erd.rowid IN (' . implode(',', $changeaccount) . ')'; - dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1); - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - setEventMessages($db->lasterror(), null, 'errors'); - } - if (! $error) { - $db->commit(); - setEventMessages($langs->trans('Save'), null, 'mesgs'); - } else { - $db->rollback(); - setEventMessages($db->lasterror(), null, 'errors'); - } + dol_syslog('accountancy/expensereport/lines.php::changeaccount sql= ' . $sql1); + $resql1 = $db->query($sql1); + if (! $resql1) { + $error ++; + setEventMessages($db->lasterror(), null, 'errors'); + } + if (! $error) { + $db->commit(); + setEventMessages($langs->trans('Save'), null, 'mesgs'); + } else { + $db->rollback(); + setEventMessages($db->lasterror(), null, 'errors'); + } - $account_parent = ''; // Protection to avoid to mass apply it a second time + $account_parent = ''; // Protection to avoid to mass apply it a second time + } } @@ -246,7 +255,7 @@ if ($result) { print $langs->trans("DescVentilDoneExpenseReport") . '
'; print '
' . $langs->trans("ChangeAccount") . '
'; - print $formaccounting->select_account(GETPOST('account_parent'), 'account_parent', 1); + print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print '
'; $moreforfilter = ''; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 1425dde58f7..e9935fc8d78 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -115,31 +115,9 @@ if ($action == 'validatehistory') { $db->commit(); setEventMessages($langs->trans('AutomaticBindingDone'), null, 'mesgs'); } -} elseif ($action == 'cleanaccountancycode') { - $error = 0; - $db->begin(); - - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; - $sql1.= " SET fk_code_ventilation = 0"; - $sql1.= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; - $sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; - $sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'"; - $sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")"; - $sql1.= ")"; - - dol_syslog("htdocs/accountancy/customer/index.php cleanaccountancycode", LOG_DEBUG); - - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - $db->rollback(); - setEventMessage($db->lasterror(), 'errors'); - } else { - $db->commit(); - setEventMessage($langs->trans('Done'), 'mesgs'); - } } + /* * View */ @@ -178,8 +156,6 @@ print '
'; $y = $year_current; $buttonbind = '' . $langs->trans("ValidateHistory") . ''; -$buttonreset = ''; -if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $buttonreset = '' . $langs->trans("CleanHistory", $year_current) . ''; print_fiche_titre($langs->trans("OverviewOfAmountOfLinesNotBound"), $buttonbind, ''); @@ -252,7 +228,7 @@ print '
'; print '
'; -print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), $buttonreset, ''); +print_fiche_titre($langs->trans("OverviewOfAmountOfLinesBound"), '', ''); print '
'; print '
'; diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index af9d82e5056..6ad8731a415 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -111,27 +111,36 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', if (is_array($changeaccount) && count($changeaccount) > 0) { $error = 0; + if (! (GETPOST('account_parent','int') >= 0)) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Account")), null, 'errors'); + } + $db->begin(); - $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as l"; - $sql1 .= " SET l.fk_code_ventilation=" . GETPOST('account_parent','int'); - $sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')'; + if (! $error) + { + $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as l"; + $sql1 .= " SET l.fk_code_ventilation=" . (GETPOST('account_parent','int') > 0 ? GETPOST('account_parent','int') : '0'); + $sql1 .= ' WHERE l.rowid IN (' . implode(',', $changeaccount) . ')'; - dol_syslog('accountancy/supplier/lines.php::changeaccount sql= ' . $sql1); - $resql1 = $db->query($sql1); - if (! $resql1) { - $error ++; - setEventMessages($db->lasterror(), null, 'errors'); - } - if (! $error) { - $db->commit(); - setEventMessages($langs->trans('Save'), null, 'mesgs'); - } else { - $db->rollback(); - setEventMessages($db->lasterror(), null, 'errors'); - } + dol_syslog('accountancy/supplier/lines.php::changeaccount sql= ' . $sql1); + $resql1 = $db->query($sql1); + if (! $resql1) { + $error ++; + setEventMessages($db->lasterror(), null, 'errors'); + } + if (! $error) { + $db->commit(); + setEventMessages($langs->trans('Save'), null, 'mesgs'); + } else { + $db->rollback(); + setEventMessages($db->lasterror(), null, 'errors'); + } - $account_parent = ''; // Protection to avoid to mass apply it a second time + $account_parent = ''; // Protection to avoid to mass apply it a second time + } } @@ -269,7 +278,7 @@ if ($result) { print $langs->trans("DescVentilDoneSupplier") . '
'; print '
' . $langs->trans("ChangeAccount") . '
'; - print $formaccounting->select_account($account_parent, 'account_parent', 1); + print $formaccounting->select_account($account_parent, 'account_parent', 2, array(), 0, 0, 'maxwidth300 maxwidthonsmartphone valignmiddle'); print '
'; $moreforfilter = ''; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index faba841e7c6..8ae6a18eb2f 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1049,13 +1049,15 @@ class Adherent extends CommonObject /** * Load member from database * - * @param int $rowid Id of object to load - * @param string $ref To load member from its ref - * @param int $fk_soc To load member from its link to third party - * @param string $ref_ext External reference - * @return int >0 if OK, 0 if not found, <0 if KO + * @param int $rowid Id of object to load + * @param string $ref To load member from its ref + * @param int $fk_soc To load member from its link to third party + * @param string $ref_ext External reference + * @param bool $fetch_optionals To load optionals (extrafields) + * @param bool $fetch_subscriptions To load member subscriptions + * @return int >0 if OK, 0 if not found, <0 if KO */ - function fetch($rowid,$ref='',$fk_soc='',$ref_ext='') + function fetch($rowid,$ref='',$fk_soc='',$ref_ext='',$fetch_optionals=true,$fetch_subscriptions=true) { global $langs; @@ -1160,10 +1162,14 @@ class Adherent extends CommonObject // Retreive all extrafield // fetch optionals attributes and labels - $this->fetch_optionals(); + if ($fetch_optionals) { + $this->fetch_optionals(); + } // Load other properties - $result=$this->fetch_subscriptions(); + if ($fetch_subscriptions) { + $result=$this->fetch_subscriptions(); + } return $this->id; } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 2393d5dad3b..4a032457f0d 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -332,7 +332,9 @@ class AdherentType extends CommonObject * Return array of Member objects for member type this->id (or all if this->id not defined) * * @param string $excludefilter Filter to exclude - * @param int $mode 0=Return array of member instance, 1=Return array of members id only + * @param int $mode 0=Return array of member instance + * 1=Return array of member instance without extra data + * 2=Return array of members id only * @return mixed Array of members or -1 on error */ function listMembersForMemberType($excludefilter='', $mode=0) @@ -355,10 +357,14 @@ class AdherentType extends CommonObject { if (! array_key_exists($obj->rowid, $ret)) { - if ($mode != 1) + if ($mode < 2) { $memberstatic=new Adherent($this->db); - $memberstatic->fetch($obj->rowid); + if ($mode == 1) { + $memberstatic->fetch($obj->rowid,'','','',false, false); + } else { + $memberstatic->fetch($obj->rowid); + } $ret[$obj->rowid]=$memberstatic; } else $ret[$obj->rowid]=$obj->rowid; @@ -457,7 +463,7 @@ class AdherentType extends CommonObject foreach($this->members as $key=>$val) // This is array of users for group into dolibarr database. { $member=new Adherent($this->db); - $member->fetch($val->id); + $member->fetch($val->id,'','','',false,false); $info2 = $member->_load_ldap_info(); $valueofldapfield[] = $member->_load_ldap_dn($info2); } diff --git a/htdocs/adherents/type_ldap.php b/htdocs/adherents/type_ldap.php index b8fc22f8f75..7edb42e6c76 100644 --- a/htdocs/adherents/type_ldap.php +++ b/htdocs/adherents/type_ldap.php @@ -63,7 +63,7 @@ if (empty($reshook)) if ($result > 0) { - $object->listMembersForMemberType(); + $object->listMembersForMemberType('', 1); $info = $object->_load_ldap_info(); $dn = $object->_load_ldap_dn($info); diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 9a4e3dcdb36..26c88b47ad3 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -41,7 +41,7 @@ $month=GETPOST("month",'int'); $day=GETPOST("day",'int'); $pid=GETPOST("projectid",'int',3); $status=GETPOST("status",'alpha'); -$type=GETPOST('type'); +$type=GETPOST('type','alphanohtml'); $optioncss = GETPOST('optioncss','alpha'); // Set actioncode (this code must be same for setting actioncode into peruser, listacton and index) if (GETPOST('actioncode','array')) @@ -355,7 +355,7 @@ if ($resql) //if ($actioncode) $nav.=''; //if ($resourceid) $nav.=''; if ($filter) $nav.=''; - if ($filtert) $nav.=''; + //if ($filtert) $nav.=''; //if ($socid) $nav.=''; if ($showbirthday) $nav.=''; //if ($pid) $nav.=''; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 086cd1128dd..8be7fa249b8 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -616,7 +616,7 @@ if (empty($reshook)) // Close proposal else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel','alpha')) { - if (! GETPOST('statut','int')) { + if (! (GETPOST('statut','int') > 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors'); $action = 'statut'; } else { diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 295d565dd98..8c234716bee 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -455,7 +455,7 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; $sql.= " FROM "; -if ($search_bid) $sql.= MAIN_DB_PREFIX."bank_class as l,"; +if ($search_bid>0) $sql.= MAIN_DB_PREFIX."bank_class as l,"; $sql.= " ".MAIN_DB_PREFIX."bank_account as ba,"; $sql.= " ".MAIN_DB_PREFIX."bank as b"; if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_extrafields as ef on (b.rowid = ef.fk_object)"; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 087f6018354..a3576a438aa 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -366,7 +366,7 @@ $sql.= ' s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.c $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.= " p.rowid as project_id, p.ref as project_ref"; +$sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label"; // 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'; @@ -979,6 +979,7 @@ if ($resql) { $projectstatic->id=$obj->project_id; $projectstatic->ref=$obj->project_ref; + $projectstatic->title=$obj->project_label; print $projectstatic->getNomUrl(1); } print ''; diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index df4909faad6..cfcb117b0a8 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -52,7 +52,6 @@ $result = restrictedArea($user, 'tax', '', '', 'charges'); $modetax = $conf->global->TAX_MODE; if (isset($_GET["modetax"])) $modetax=GETPOST("modetax",'alpha'); - /** * print function * @@ -174,16 +173,16 @@ $y = $year_current ; $total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0; $i=0; for ($m = 1 ; $m < 13 ; $m++ ) { - $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m); - $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m); - + $coll_listsell = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'sell', $m); + $coll_listbuy = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'buy', $m); + $action = "tva"; $object = array(&$coll_listsell, &$coll_listbuy); $parameters["mode"] = $modetax; $parameters["year"] = $y; $parameters["month"] = $m; $parameters["type"] = 'localtax'.$localTaxType; - + // Initialize technical object to manage hooks of expenses. Note that conf->hooks_modules contains array array $hookmanager->initHooks(array('externalbalance')); $reshook=$hookmanager->executeHooks('addVatLine',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks @@ -198,7 +197,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) { break; } - + print ''; print ''; if($CalcLT==0) { @@ -229,7 +228,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) { } $subtotalcoll = $subtotalcoll + $x_coll; print ""; - + } if($CalcLT==0) { @@ -239,7 +238,7 @@ for ($m = 1 ; $m < 13 ; $m++ ) { } elseif($CalcLT==2) { $diff= $x_coll; } - + $total = $total + $diff; $subtotal = $subtotal + $diff; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index b5e6fee4f6f..5692f3d97bb 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -107,13 +107,13 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); } } -// $date_start and $date_end are defined. We force $start_year and $nbofyear +// $date_start and $date_end are defined. We force $year_start and $nbofyear $tmps=dol_getdate($date_start); -$start_year = $tmps['year']; +$year_start = $tmps['year']; $tmpe=dol_getdate($date_end); $year_end = $tmpe['year']; $nbofyear = ($year_end - $start_year) + 1; -//var_dump($start_year." ".$end_year." ".$nbofyear); +//var_dump("year_start=".$year_start." year_end=".$year_end." nbofyear=".$nbofyear." date_start=".dol_print_date($date_start, 'dayhour')." date_end=".dol_print_date($date_end, 'dayhour')); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES' or 'BOOKKEEPING') $modecompta = $conf->global->ACCOUNTING_MODE; @@ -253,8 +253,8 @@ if ($modecompta == 'BOOKKEEPING') $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as f"; $sql.= ", ".MAIN_DB_PREFIX."accounting_account as aa"; $sql.= " WHERE f.numero_compte = aa.account_number"; - //$sql.= " AND fk_statut in (1,2)"; $sql.= " AND ".$predefinedgroupwhere; + $sql.= " AND fk_pcg_version = '".$db->escape($charofaccountstring)."'"; $sql.= " AND f.entity = ".$conf->entity; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND f.doc_date >= '".$db->idate($date_start)."' AND f.doc_date <= '".$db->idate($date_end)."'"; @@ -295,7 +295,7 @@ if ($modecompta == 'BOOKKEEPING') if ($showaccountdetail != 'no') { $tmppredefinedgroupwhere="pcg_type = '".$db->escape($objp->pcg_type)."' AND pcg_subtype = '".$db->escape($objp->pcg_subtype)."'"; - $tmppredefinedgroupwhere.= " AND fk_pcg_version = '".$charofaccountstring."'"; + $tmppredefinedgroupwhere.= " AND fk_pcg_version = '".$db->escape($charofaccountstring)."'"; //$tmppredefinedgroupwhere.= " AND thirdparty_code = '".$db->escape($objp->name)."'"; // Get cpts of category/group @@ -312,7 +312,7 @@ if ($modecompta == 'BOOKKEEPING') } - if ($showaccountdetail == 'all' || $resultN > 0) + if ($showaccountdetail == 'all' || $resultN <> 0) { print ''; print ''; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 26647d5f0f0..e8b00fc869b 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -85,13 +85,14 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if ($q==4) { $date_start=dol_get_first_day($year_start,10,false); $date_end=dol_get_last_day($year_start,12,false); } } -// $date_start and $date_end are defined. We force $start_year and $nbofyear +// $date_start and $date_end are defined. We force $year_start and $nbofyear $tmps=dol_getdate($date_start); -$start_year = $tmps['year']; +$year_start = $tmps['year']; $tmpe=dol_getdate($date_end); $year_end = $tmpe['year']; $nbofyear = ($year_end - $start_year) + 1; -//var_dump($start_year." ".$end_year." ".$nbofyear); +//var_dump("year_start=".$year_start." year_end=".$year_end." nbofyear=".$nbofyear." date_start=".dol_print_date($date_start, 'dayhour')." date_end=".dol_print_date($date_end, 'dayhour')); + // Security check $socid = GETPOST('socid','int'); @@ -376,7 +377,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); - $var=false; $i = 0; if ($num) { while ($i < $num) { @@ -409,7 +409,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); - $var=false; $i = 0; if ($num) { while ($i < $num) { @@ -443,7 +442,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); - $var=false; $i = 0; if ($num) { while ($i < $num) { @@ -474,7 +472,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); - $var=false; $i = 0; if ($num) { while ($i < $num) { @@ -537,7 +534,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); - $var=false; $i = 0; if ($num) { while ($i < $num) { @@ -600,7 +596,6 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); - $var=false; $i = 0; if ($num) { while ($i < $num) { @@ -647,7 +642,6 @@ if (! empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $m $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - $var = false; $i = 0; if ($num) { while ($i < $num) { @@ -775,7 +769,6 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco if ($result) { $num = $db->num_rows($result); - $var=false; $i = 0; if ($num) { @@ -810,32 +803,35 @@ elseif ($modecompta == 'BOOKKEEPING') { if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) { - $subtotal_ht = 0; - $subtotal_ttc = 0; + $predefinedgroupwhere = "("; + //$predefinedgroupwhere.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))"; + $predefinedgroupwhere.= " (pcg_type = 'EXPENSE')"; + $predefinedgroupwhere.= " OR "; + //$predefinedgroupwhere.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))"; + $predefinedgroupwhere.= " (pcg_type = 'INCOME')"; + $predefinedgroupwhere.= ")"; + + $charofaccountstring = $conf->global->CHARTOFACCOUNTS; + $charofaccountstring=dol_getIdFromCode($db, $conf->global->CHARTOFACCOUNTS, 'accounting_system', 'rowid', 'pcg_version'); $sql = "SELECT b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, pcg_type, date_format(b.doc_date,'%Y-%m') as dm, sum(b.debit) as debit, sum(b.credit) as credit, sum(b.montant) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_account as aa"; $sql.= " WHERE b.numero_compte = aa.account_number AND b.entity = ".$conf->entity; - //$sql.= " AND fk_statut in (1,2)"; - $sql.= " AND ("; - //$sql.= " (pcg_type = 'EXPENSE' and pcg_subtype in ('PRODUCT','SERVICE'))"; - $sql.= " (pcg_type = 'EXPENSE')"; - $sql.= " OR "; - //$sql.= " (pcg_type = 'INCOME' and pcg_subtype in ('PRODUCT','SERVICE'))"; - $sql.= " (pcg_type = 'INCOME')"; - $sql.= ")"; - //$sql.= " AND code_journal in ('VT', 'AC')"; + $sql.= " AND ".$predefinedgroupwhere; + $sql.= " AND fk_pcg_version = '".$db->escape($charofaccountstring)."'"; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND b.doc_date >= '".$db->idate($date_start)."' AND b.doc_date <= '".$db->idate($date_end)."'"; $sql.= " GROUP BY b.doc_ref, b.numero_compte, b.subledger_account, b.subledger_label, pcg_type, dm"; //print $sql; + $subtotal_ht = 0; + $subtotal_ttc = 0; + dol_syslog("get bookkeeping record"); $result=$db->query($sql); if ($result) { $num = $db->num_rows($result); - $var=false; $i = 0; if ($num) { @@ -845,9 +841,8 @@ if (! empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0; $encaiss[$obj->dm] += $obj->debit; - if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0; - $encaiss_ttc[$obj->dm] += $obj->credit; + $encaiss_ttc[$obj->dm] += 0; $i++; } @@ -908,7 +903,6 @@ for ($annee = $year_start ; $annee <= $year_end ; $annee++) } print ''; -$var=True; // Loop on each month $nb_mois_decalage = $conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START-1):0; @@ -926,21 +920,44 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois_modulo,1,$annee_decalage)); print '"; print '"; } @@ -951,7 +968,10 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) // Total $nbcols=0; -print ''; +print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { $nbcols+=2; diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index bbe05ea1111..0ccd7013ba4 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -160,8 +160,8 @@ $total=0; $subtotalcoll=0; $subtotalpaye=0; $subtotal=0; $i=0; for ($m = 1 ; $m < 13 ; $m++ ) { - $coll_listsell = vat_by_date($db, $y, 0, 0, 0, $modetax, 'sell', $m); - $coll_listbuy = vat_by_date($db, $y, 0, 0, 0, $modetax, 'buy', $m); + $coll_listsell = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'sell', $m); + $coll_listbuy = tax_by_date('vat', $db, $y, 0, 0, 0, $modetax, 'buy', $m); $action = "tva"; $object = array(&$coll_listsell, &$coll_listbuy); diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 1b60a5603bb..92b67dbfd6f 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -198,8 +198,8 @@ $i=0; $columns = 5; // Load arrays of datas -$x_coll = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'sell'); -$x_paye = vat_by_date($db, 0, 0, $date_start, $date_end, $modetax, 'buy'); +$x_coll = tax_by_date('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'sell'); +$x_paye = tax_by_date('vat', $db, 0, 0, $date_start, $date_end, $modetax, 'buy'); if (! is_array($x_coll) || ! is_array($x_paye)) { diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index c513db1b49f..d443956a9fe 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -101,7 +101,7 @@ if (! $sortfield) $sortfield='a.datep, a.id'; if (! $sortorder) $sortorder='DESC'; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('contactcard','globalcard')); +$hookmanager->initHooks(array('contactagenda','globalcard')); /* diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index da77c5a4f9b..5bdc58cc61a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6551,7 +6551,7 @@ abstract class CommonObject * * @return array */ - protected function set_save_query() + protected function setSaveQuery() { global $conf; @@ -6650,7 +6650,7 @@ abstract class CommonObject * * @return string */ - protected function get_field_list() + protected function getFieldList() { $keys = array_keys($this->fields); return implode(',', $keys); @@ -6685,7 +6685,7 @@ abstract class CommonObject $now=dol_now(); - $fieldvalues = $this->set_save_query(); + $fieldvalues = $this->setSaveQuery(); if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation']=$this->db->idate($now); if (array_key_exists('fk_user_creat', $fieldvalues) && ! ($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat']=$user->id; unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert. @@ -6778,7 +6778,7 @@ abstract class CommonObject { if (empty($id) && empty($ref)) return false; - $sql = 'SELECT '.$this->get_field_list(); + $sql = 'SELECT '.$this->getFieldList(); $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element; if (!empty($id)) $sql.= ' WHERE rowid = '.$id; @@ -6822,7 +6822,7 @@ abstract class CommonObject $now=dol_now(); - $fieldvalues = $this->set_save_query(); + $fieldvalues = $this->setSaveQuery(); if (array_key_exists('date_modification', $fieldvalues) && empty($fieldvalues['date_modification'])) $fieldvalues['date_modification']=$this->db->idate($now); if (array_key_exists('fk_user_modif', $fieldvalues) && ! ($fieldvalues['fk_user_modif'] > 0)) $fieldvalues['fk_user_modif']=$user->id; unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into update. diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 2d5ba165365..8deb214782e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1743,7 +1743,7 @@ class ExtraFields */ function showSeparator($key) { - $out = ''; + $out = ''; return $out; } diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index aaae010c2fe..a79f01352e8 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -243,7 +243,7 @@ class FormAccounting extends Form * * @param string $selectid Preselected id or code of accounting accounts (depends on $select_in) * @param string $htmlname Name of HTML field id. If name start with '.', it is name of HTML css class, so several component with same name in different forms can be used. - * @param int $showempty Add an empty field + * @param int $showempty 1=Add an empty field, 2=Add an empty field+'None' field * @param array $event Event options * @param int $select_in 0=selectid value is a aa.rowid (default) or 1=selectid is aa.account_number * @param int $select_out Set value returned by select. 0=rowid (default), 1=account_number @@ -253,7 +253,7 @@ class FormAccounting extends Form */ function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='') { - global $conf; + global $conf, $langs; require_once DOL_DOCUMENT_ROOT . '/core/lib/accounting.lib.php'; @@ -318,7 +318,12 @@ class FormAccounting extends Form } } - $out .= Form::selectarray($htmlname, $options, $selected, $showempty, 0, 0, '', 0, 0, 0, '', $morecss, 1); + if ($showempty == 2) + { + $options['0'] = $langs->trans("None"); + } + + $out .= Form::selectarray($htmlname, $options, $selected, ($showempty > 0 ? 1 : 0), 0, 0, '', 0, 0, 0, '', $morecss, 1); return $out; } diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index e1ee7ae04ff..dba8c5d24e5 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -122,13 +122,13 @@ class FormBarCode if ($useempty && $num > 0) { - print ''; print ''; } else { $langs->load("errors"); - print ''; print ''; } diff --git a/htdocs/core/get_info.php b/htdocs/core/get_info.php new file mode 100644 index 00000000000..7b2c57b42e3 --- /dev/null +++ b/htdocs/core/get_info.php @@ -0,0 +1,209 @@ + + * + * This file is a modified version of datepicker.php from phpBSM to fix some + * bugs, to add new features and to dramatically increase speed. + * + * 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 + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/core/get_info.php + * \brief File to return a single page with just logged user info, to be used by other frontend + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); +//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); +//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); + +require_once '../main.inc.php'; + +if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php + +$langs->load("main"); + +$right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); +$left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); + + +/* + * View + */ + +$title=$langs->trans("Info"); + +// URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests +$head=''."\n"; +$arrayofjs=array(); +$arrayofcss=array(); +top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss); + + + +print ''."\n"; +print '
'; +//print '
'; + +$nbofsearch=0; + +// Define link to login card +$appli=constant('DOL_APPLICATION_TITLE'); +if (! empty($conf->global->MAIN_APPLICATION_TITLE)) +{ + $appli=$conf->global->MAIN_APPLICATION_TITLE; + if (preg_match('/\d\.\d/', $appli)) + { + if (! preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli.=" (".DOL_VERSION.")"; // If new title contains a version that is different than core + } + else $appli.=" ".DOL_VERSION; +} +else $appli.=" ".DOL_VERSION; + +if (! empty($conf->global->MAIN_FEATURES_LEVEL)) $appli.="
".$langs->trans("LevelOfFeature").': '.$conf->global->MAIN_FEATURES_LEVEL; + +$logouttext=''; +if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) +{ + //$logouthtmltext=$appli.'
'; + if ($_SESSION["dol_authmode"] != 'forceuser' && $_SESSION["dol_authmode"] != 'http') + { + $logouthtmltext.=$langs->trans("Logout").'
'; + + $logouttext .=''; + //$logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); + $logouttext .=''; + $logouttext .=''; + } + else + { + $logouthtmltext.=$langs->trans("NoLogoutProcessWithAuthMode",$_SESSION["dol_authmode"]); + $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); + } +} + +print ''; + +print $toprightmenu; + +print "
\n"; // end div class="login_block" + +print ''; +print ''."\n"; + +$db->close(); diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php index 3ff299fa00c..3b49482a217 100644 --- a/htdocs/core/get_menudiv.php +++ b/htdocs/core/get_menudiv.php @@ -20,7 +20,7 @@ /** * \file htdocs/core/get_menudiv.php - * \brief File to return menu into a div tree + * \brief File to return menu into a div tree, to be used by other frontend */ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language @@ -37,8 +37,6 @@ if (! defined('DISABLE_JQUERY_TABLEDND')) define('DISABLE_JQUERY_TABLEDND',1); if (! defined('DISABLE_JQUERY_JNOTIFY')) define('DISABLE_JQUERY_JNOTIFY',1); if (! defined('DISABLE_JQUERY_FLOT')) define('DISABLE_JQUERY_FLOT',1); if (! defined('DISABLE_JQUERY_JEDITABLE')) define('DISABLE_JQUERY_JEDITABLE',1); -if (! defined('DISABLE_JQUERY_JEDITABLE')) define('DISABLE_JQUERY_JEDITABLE',1); -if (! defined('DISABLE_CKEDITOR')) define('DISABLE_CKEDITOR',1); if (! defined('DISABLE_CKEDITOR')) define('DISABLE_CKEDITOR',1); if (! defined('DISABLE_BROWSER_NOTIF')) define('DISABLE_BROWSER_NOTIF',1); if (! defined('DISABLE_DATE_PICKER')) define('DISABLE_DATE_PICKER',1); diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index ab792f07771..d2bc3b37183 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -32,7 +32,7 @@ * Prepare array with list of tabs * * @param ChargeSociales $object Object related to tabs - * @return array Array of tabs to show + * @return array Array of tabs to show */ function tax_prepare_head(ChargeSociales $object) { @@ -184,7 +184,6 @@ function vat_by_thirdparty($db, $y, $date_start, $date_end, $modetax, $direction * Gets Tax to collect for the given year (and given quarter or month) * The function gets the Tax in split results, as the Tax declaration asks * to report the amounts for different Tax rates as different lines. - * This function also accounts recurrent invoices. * * @param string $type Tax type, either 'vat', 'localtax1' or 'localtax2' * @param DoliDB $db Database handler object @@ -323,7 +322,7 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire if ($sql == 'TODO') return -2; if ($sql != 'TODO') { - dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG); + dol_syslog("Tax.lib.php::tax_by_date", LOG_DEBUG); $resql = $db->query($sql); if ($resql) @@ -466,13 +465,13 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire if (! $sql) { - dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR); + dol_syslog("Tax.lib.php::tax_by_date no accountancy module enabled".$sql,LOG_ERR); return -1; // -1 = Not accountancy module enabled } if ($sql == 'TODO') return -2; // -2 = Feature not yet available if ($sql != 'TODO') { - dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG); + dol_syslog("Tax.lib.php::tax_by_date", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -565,13 +564,13 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire if (! $sql) { - dol_syslog("Tax.lib.php::vat_by_date no accountancy module enabled".$sql,LOG_ERR); + dol_syslog("Tax.lib.php::tax_by_date no accountancy module enabled".$sql,LOG_ERR); return -1; // -1 = Not accountancy module enabled } if ($sql == 'TODO') return -2; // -2 = Feature not yet available if ($sql != 'TODO') { - dol_syslog("Tax.lib.php::vat_by_date", LOG_DEBUG); + dol_syslog("Tax.lib.php::tax_by_date", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { @@ -633,24 +632,3 @@ function tax_by_date($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire return $list; } -/** - * Gets VAT to collect for the given year (and given quarter or month) - * The function gets the VAT in split results, as the VAT declaration asks - * to report the amounts for different VAT rates as different lines. - * This function also accounts recurrent invoices. - * - * @param DoliDB $db Database handler object - * @param int $y Year - * @param int $q Quarter - * @param string $date_start Start date - * @param string $date_end End date - * @param int $modetax 0 or 1 (option vat on debit) - * @param int $direction 'sell' (customer invoice) or 'buy' (supplier invoices) - * @param int $m Month - * @return array List of quarters with vat - */ -function vat_by_date ($db, $y, $q, $date_start, $date_end, $modetax, $direction, $m=0) -{ - return tax_by_date('vat', $db, $y, $q, $date_start, $date_end, $modetax, $direction, $m); -} - diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index 5d790f3c6dc..52fbeac21d5 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -38,23 +38,78 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; */ class pdf_aurore extends ModelePDFSupplierProposal { - var $db; - var $name; - var $description; - var $type; + /** + * @var DoliDb Database handler + */ + public $db; + + /** + * @var string model name + */ + public $name; + + /** + * @var string model description (short text) + */ + public $description; + + /** + * @var string document type + */ + public $type; - var $phpmin = array(4,3,0); // Minimum version of PHP required by module - var $version = 'dolibarr'; + /** + * @var array() Minimum version of PHP required by module. + * e.g.: PHP ≥ 5.3 = array(5, 3) + */ + public $phpmin = array(5, 2); + + /** + * Dolibarr version of the loaded document + * @public string + */ + public $version = 'dolibarr'; - var $page_largeur; - var $page_hauteur; - var $format; - var $marge_gauche; - var $marge_droite; - var $marge_haute; - var $marge_basse; + /** + * @var int page_largeur + */ + public $page_largeur; + + /** + * @var int page_hauteur + */ + public $page_hauteur; + + /** + * @var array format + */ + public $format; + + /** + * @var int marge_gauche + */ + public $marge_gauche; + + /** + * @var int marge_droite + */ + public $marge_droite; + + /** + * @var int marge_haute + */ + public $marge_haute; + + /** + * @var int marge_basse + */ + public $marge_basse; - var $emetteur; // Objet societe qui emet + /** + * Issuer + * @var Societe + */ + public $emetteur; /** @@ -62,9 +117,9 @@ class pdf_aurore extends ModelePDFSupplierProposal * * @param DoliDB $db Database handler */ - function __construct($db) + public function __construct($db) { - global $conf,$langs,$mysoc; + global $conf, $langs, $mysoc; // Translations $langs->loadLangs(array("main", "bills")); @@ -146,13 +201,9 @@ class pdf_aurore extends ModelePDFSupplierProposal if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - - $outputlangs->load("main"); - $outputlangs->load("dict"); - $outputlangs->load("companies"); - $outputlangs->load("bills"); - $outputlangs->load("supplier_proposal"); - $outputlangs->load("products"); + + // Translations + $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "supplier_proposal")); $nblignes = count($object->lines); @@ -1188,11 +1239,9 @@ class pdf_aurore extends ModelePDFSupplierProposal function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf,$langs; - - $outputlangs->load("main"); - $outputlangs->load("bills"); - $outputlangs->load("supplier_proposal"); - $outputlangs->load("companies"); + + // Translations + $outputlangs->loadLangs(array("main", "bills", "supplier_proposal", "companies")); $default_font_size = pdf_getPDFFontSize($outputlangs); diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index 1e9c2c2ec31..8cfece7dc89 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -440,7 +440,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers if ($object->typeid > 0) { $membertype->fetch($object->typeid); - $membertype->listMembersForMemberType(); + $membertype->listMembersForMemberType('', 1); $oldinfo=$membertype->_load_ldap_info(); $olddn=$membertype->_load_ldap_dn($oldinfo); @@ -560,7 +560,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers */ $newmembertype=new AdherentType($this->db); $newmembertype->fetch($object->typeid); - $newmembertype->listMembersForMemberType(); + $newmembertype->listMembersForMemberType('', 1); $oldinfo=$newmembertype->_load_ldap_info(); $olddn=$newmembertype->_load_ldap_dn($oldinfo); @@ -586,7 +586,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers */ $oldmembertype=new AdherentType($this->db); $oldmembertype->fetch($object->oldcopy->typeid); - $oldmembertype->listMembersForMemberType(); + $oldmembertype->listMembersForMemberType('', 1); $oldinfo=$oldmembertype->_load_ldap_info(); $olddn=$oldmembertype->_load_ldap_dn($oldinfo); @@ -684,7 +684,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers */ $membertype=new AdherentType($this->db); $membertype->fetch($object->typeid); - $membertype->listMembersForMemberType('a.rowid != ' . $object->id); // remove deleted member from the list + $membertype->listMembersForMemberType('a.rowid != ' . $object->id, 1); // remove deleted member from the list $oldinfo=$membertype->_load_ldap_info(); $olddn=$membertype->_load_ldap_dn($oldinfo); @@ -751,7 +751,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $object->oldcopy = clone $object; } - $object->oldcopy->listMembersForMemberType(); + $object->oldcopy->listMembersForMemberType('', 1); $oldinfo=$object->oldcopy->_load_ldap_info(); $olddn=$object->oldcopy->_load_ldap_dn($oldinfo); @@ -765,7 +765,7 @@ class InterfaceLdapsynchro extends DolibarrTriggers $olddn = ''; } - $object->listMembersForMemberType(); + $object->listMembersForMemberType('', 1); $info=$object->_load_ldap_info(); $dn=$object->_load_ldap_dn($info); diff --git a/htdocs/dav/dav.class.php b/htdocs/dav/dav.class.php index c0220d77a66..25f2ac8ccc7 100644 --- a/htdocs/dav/dav.class.php +++ b/htdocs/dav/dav.class.php @@ -23,10 +23,8 @@ /** - * Define Common function to access calendar items - * And format it in vCalendar - * */ - + * Define Common function to access calendar items and format it in vCalendar + */ class CdavLib { @@ -46,8 +44,9 @@ class CdavLib /** * Base sql request for calendar events * - * @param int calendar user id - * @param int actioncomm object id + * @param int $calid Calendard id + * @param int|boolean $oid Oid + * @param int|boolean $ouri Ouri * @return string */ public function getSqlCalEvents($calid, $oid=false, $ouri=false) @@ -113,14 +112,14 @@ class CdavLib /** * Convert calendar row to VCalendar string * - * @param row object + * @param int $calid Calendar id + * @param Object $obj Object id * @return string */ public function toVCalendar($calid, $obj) { - - $categ = []; - /*if($obj->soc_client) + /*$categ = array(); + if($obj->soc_client) { $nick[] = $obj->soc_code_client; $categ[] = $this->langs->transnoentitiesnoconv('Customer'); @@ -240,11 +239,17 @@ class CdavLib return $caldata; } + /** + * getFullCalendarObjects + * + * @param int $calendarId Calendar id + * @param int $bCalendarData Add calendar data + * @return array|string[][]|unknown[][]|NULL[][] + */ public function getFullCalendarObjects($calendarId, $bCalendarData) { - $calid = ($calendarId*1); - $calevents = [] ; + $calevents = array(); if(! $this->user->rights->agenda->myactions->read) return $calevents; @@ -264,7 +269,7 @@ class CdavLib if($bCalendarData) { - $calevents[] = [ + $calevents[] = array( 'calendardata' => $calendardata, 'uri' => $obj->id.'-ev-'.CDAV_URI_KEY, 'lastmodified' => strtotime($obj->lastupd), @@ -272,11 +277,11 @@ class CdavLib 'calendarid' => $calendarId, 'size' => strlen($calendardata), 'component' => strpos($calendardata, 'BEGIN:VEVENT')>0 ? 'vevent' : 'vtodo', - ]; + ); } else { - $calevents[] = [ + $calevents[] = array( // 'calendardata' => $calendardata, not necessary because etag+size are present 'uri' => $obj->id.'-ev-'.CDAV_URI_KEY, 'lastmodified' => strtotime($obj->lastupd), @@ -284,7 +289,7 @@ class CdavLib 'calendarid' => $calendarId, 'size' => strlen($calendardata), 'component' => strpos($calendardata, 'BEGIN:VEVENT')>0 ? 'vevent' : 'vtodo', - ]; + ); } } } diff --git a/htdocs/fourn/commande/dispatch.php b/htdocs/fourn/commande/dispatch.php index 43e70c03013..837e32f9ff6 100644 --- a/htdocs/fourn/commande/dispatch.php +++ b/htdocs/fourn/commande/dispatch.php @@ -484,7 +484,7 @@ if ($id > 0 || ! empty($ref)) { } $sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,"; - $sql .= " p.ref, p.label, p.tobatch"; + $sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse"; $sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l"; $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid"; $sql .= " WHERE l.fk_commande = " . $object->id; @@ -676,9 +676,9 @@ if ($id > 0 || ! empty($ref)) { // Warehouse print '
'; diff --git a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql index 665adb0768c..92a58472700 100644 --- a/htdocs/install/mysql/migration/7.0.0-8.0.0.sql +++ b/htdocs/install/mysql/migration/7.0.0-8.0.0.sql @@ -39,6 +39,8 @@ ALTER TABLE llx_website_page ADD COLUMN type_container varchar(16) NOT NULL DEFA DROP TABLE llx_c_accountancy_category; DROP TABLE llx_c_accountingaccount; +update llx_propal set fk_statut = 1 where fk_statut = -1; + -- For 8.0 @@ -297,12 +299,12 @@ CREATE TABLE llx_societe_account( ALTER TABLE llx_const MODIFY type varchar(64) DEFAULT 'string'; UPDATE llx_const set type = 'text' where type = 'texte'; -UPDATE llx_const set type = 'html' where name in ('ADHERENT_AUTOREGISTER_NOTIF_MAIL','ADHERENT_AUTOREGISTER_MAIL','ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'); +UPDATE llx_const set type = 'html' where name in (__ENCRYPT('ADHERENT_AUTOREGISTER_NOTIF_MAIL')__,__ENCRYPT('ADHERENT_AUTOREGISTER_MAIL')__,__ENCRYPT('ADHERENT_MAIL_VALID')__,__ENCRYPT('ADHERENT_MAIL_COTIS')__,__ENCRYPT('ADHERENT_MAIL_RESIL')__); ---UPDATE llx_const SET value = '', type = 'emailtemplate:member' WHERE name = 'ADHERENT_AUTOREGISTER_MAIL' AND type != 'emailtemplate:member'; ---UPDATE llx_const SET value = '', type = 'emailtemplate:member' WHERE name = 'ADHERENT_MAIL_VALID' AND type != 'emailtemplate:member'; ---UPDATE llx_const SET value = '', type = 'emailtemplate:member' WHERE name = 'ADHERENT_MAIL_COTIS' AND type != 'emailtemplate:member'; ---UPDATE llx_const SET value = '', type = 'emailtemplate:member' WHERE name = 'ADHERENT_MAIL_RESIL' AND type != 'emailtemplate:member'; +--UPDATE llx_const SET value = '', type = 'emailtemplate:member' WHERE name = __ENCRYPT('ADHERENT_AUTOREGISTER_MAIL')__ AND type != 'emailtemplate:member'; +--UPDATE llx_const SET value = '', type = 'emailtemplate:member' WHERE name = __ENCRYPT('ADHERENT_MAIL_VALID')__ AND type != 'emailtemplate:member'; +--UPDATE llx_const SET value = '', type = 'emailtemplate:member' WHERE name = __ENCRYPT('ADHERENT_MAIL_COTIS')__ AND type != 'emailtemplate:member'; +--UPDATE llx_const SET value = '', type = 'emailtemplate:member' WHERE name = __ENCRYPT('ADHERENT_MAIL_RESIL')__ AND type != 'emailtemplate:member'; ALTER TABLE llx_societe_account ADD COLUMN key_account varchar(128); @@ -329,3 +331,7 @@ INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_u INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingReminderForExpiredSubscription)',40,1,1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(SubscriptionReminderEmail)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(ThisIsContentOfSubscriptionReminderEmail)__
\n
__ONLINE_PAYMENT_TEXT_AND_URL__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingEmailOnCancelation)' ,50,1,1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourMembershipWasCanceled)__', '__(Hello)__ __MEMBER_FULLNAME__,

\n\n__(YourMembershipWasCanceled)__
\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); INSERT INTO llx_c_email_templates (entity,module,type_template,lang,private,fk_user,datec,label,position,enabled,active,topic,content,content_lines,joinfiles) VALUES (0,'adherent','member','',0,null,null,'(SendingAnEMailToMember)' ,60,1,1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(CardContent)__', '__(Hello)__,

\n\n__(ThisIsContentOfYourCard)__
\n__(ID)__ : __ID__
\n__(Civiliyty)__ : __MEMBER_CIVILITY__
\n__(Firstname)__ : __MEMBER_FIRSTNAME__
\n__(Lastname)__ : __MEMBER_LASTNAME__
\n__(Fullname)__ : __MEMBER_FULLNAME__
\n__(Company)__ : __MEMBER_COMPANY__
\n__(Address)__ : __MEMBER_ADDRESS__
\n__(Zip)__ : __MEMBER_ZIP__
\n__(Town)__ : __MEMBER_TOWN__
\n__(Country)__ : __MEMBER_COUNTRY__
\n__(Email)__ : __MEMBER_EMAIL__
\n__(Birthday)__ : __MEMBER_BIRTH__
\n__(Photo)__ : __MEMBER_PHOTO__
\n__(Login)__ : __MEMBER_LOGIN__
\n__(Password)__ : __MEMBER_PASSWORD__
\n__(Phone)__ : __MEMBER_PHONE__
\n__(PhonePerso)__ : __MEMBER_PHONEPRO__
\n__(PhoneMobile)__ : __MEMBER_PHONEMOBILE__

\n__(Sincerely)__
__USER_SIGNATURE__',null, 1); + +ALTER TABLE llx_product ADD COLUMN fk_default_warehouse integer DEFAULT NULL; +ALTER TABLE llx_product ADD CONSTRAINT fk_product_default_warehouse FOREIGN KEY (fk_default_warehouse) REFERENCES llx_entrepot (rowid); + diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql index 149ad78ee7a..69cd2a3bc79 100755 --- a/htdocs/install/mysql/migration/repair.sql +++ b/htdocs/install/mysql/migration/repair.sql @@ -348,6 +348,8 @@ update llx_facturedet set product_type = 1 where product_type = 2; --update llx_commandedet as d set d.product_type = 1 where d.fk_product = 22 and d.product_type = 0; --update llx_facturedet as d set d.product_type = 1 where d.fk_product = 22 and d.product_type = 0; +update llx_propal set fk_statut = 1 where fk_statut = -1; + delete from llx_commande_fournisseur_dispatch where fk_commandefourndet = 0 or fk_commandefourndet IS NULL; diff --git a/htdocs/install/mysql/tables/llx_product.key.sql b/htdocs/install/mysql/tables/llx_product.key.sql index 5157861ba4b..40b4eb130a9 100644 --- a/htdocs/install/mysql/tables/llx_product.key.sql +++ b/htdocs/install/mysql/tables/llx_product.key.sql @@ -35,3 +35,4 @@ ALTER TABLE llx_product ADD CONSTRAINT fk_product_fk_unit FOREIGN KEY (fk_unit) ALTER TABLE llx_product ADD CONSTRAINT fk_product_fk_country FOREIGN KEY (fk_country) REFERENCES llx_c_country (rowid); 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_default_warehouse FOREIGN KEY (fk_default_warehouse) REFERENCES llx_entrepot (rowid); diff --git a/htdocs/install/mysql/tables/llx_product.sql b/htdocs/install/mysql/tables/llx_product.sql index 21da795cd4e..1e201038122 100755 --- a/htdocs/install/mysql/tables/llx_product.sql +++ b/htdocs/install/mysql/tables/llx_product.sql @@ -85,6 +85,7 @@ create table llx_product pmp double(24,8) DEFAULT 0 NOT NULL, -- To store valuation of stock calculated using average price method, for this product fifo double(24,8), -- To store valuation of stock calculated using fifo method, for this product. TODO Not used, should be replaced by stock value stored into movement table. lifo double(24,8), -- To store valuation of stock calculated using lifo method, for this product. TODO Not used, should be replaced by stock value stored into movement table. + fk_default_warehouse integer DEFAULT NULL, canvas varchar(32) DEFAULT NULL, finished tinyint DEFAULT NULL, -- 1=manufactured product, 0=matiere premiere hidden tinyint DEFAULT 0, -- Not used. Deprecated. diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 62d2e23e66c..d8261fbe2ec 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -8,7 +8,9 @@ WarehouseEdit=Modify warehouse MenuNewWarehouse=New warehouse WarehouseSource=Source warehouse WarehouseSourceNotDefined=No warehouse defined, +AddWarehouse=Create warehouse AddOne=Add one +DefaultWarehouse=Default warehouse WarehouseTarget=Target warehouse ValidateSending=Delete sending CancelSending=Cancel sending diff --git a/htdocs/langs/en_US/ticketsup.lang b/htdocs/langs/en_US/ticketsup.lang index cd79202c7fa..d46a6be5dbd 100644 --- a/htdocs/langs/en_US/ticketsup.lang +++ b/htdocs/langs/en_US/ticketsup.lang @@ -52,6 +52,7 @@ TypeContact_ticketsup_internal_SUPPORTTEC=Assigned user TypeContact_ticketsup_external_SUPPORTCLI=Customer contact / incident tracking TypeContact_ticketsup_external_CONTRIBUTOR=External contributor +OriginEmail=Email source Notify_TICKETMESSAGE_SENTBYMAIL=Send ticket answer by email # Status diff --git a/htdocs/langs/fr_FR/holiday.lang b/htdocs/langs/fr_FR/holiday.lang index e1a3b46bcf1..57d57c06bef 100644 --- a/htdocs/langs/fr_FR/holiday.lang +++ b/htdocs/langs/fr_FR/holiday.lang @@ -85,6 +85,10 @@ EmployeeFirstname=Prénom du salarié TypeWasDisabledOrRemoved=Le type de congés (id %s) a été désactivé ou supprimé LastHolidays=Les %s dernières demandes de congés AllHolidays=Toutes les demandes de congés +LEAVE_PAID=Congé payés +LEAVE_SICK=Arrêt maladie +LEAVE_OTHER=Autre congé +LEAVE_PAID_FR=congé payés ## Configuration du Module ## LastUpdateCP=Dernière mise à jour automatique de l'allocation des congés diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index c3bd5c184c0..0289fed4e14 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1116,12 +1116,8 @@ function top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs if (empty($conf->css)) $conf->css = '/theme/eldy/style.css.php'; // If not defined, eldy by default - if (! empty($conf->global->MAIN_ACTIVATE_HTML4)) { - $doctype = ''; - }else { - $doctype = ''; - } - print $doctype."\n"; + print ''."\n"; + if (! empty($conf->global->MAIN_USE_CACHE_MANIFEST)) print ''."\n"; else print ''."\n"; //print ''."\n"; @@ -1572,7 +1568,8 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a print $toprightmenu; - print "\n"; + print "\n"; // end div class="login_block" + print ''; //unset($form); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index f65898bda68..a2794801fae 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -292,6 +292,7 @@ if (empty($reshook)) $object->country_id = GETPOST('country_id'); $object->duration_value = $duration_value; $object->duration_unit = $duration_unit; + $object->fk_default_warehouse = GETPOST('fk_default_warehouse'); $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte')?GETPOST('seuil_stock_alerte'):0; $object->desiredstock = GETPOST('desiredstock')?GETPOST('desiredstock'):0; $object->canvas = GETPOST('canvas'); @@ -390,6 +391,7 @@ if (empty($reshook)) $object->status_buy = GETPOST('statut_buy'); $object->status_batch = GETPOST('status_batch'); // removed from update view so GETPOST always empty + $object->fk_default_warehouse = GETPOST('fk_default_warehouse'); /* $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $object->desiredstock = GETPOST('desiredstock'); @@ -995,9 +997,14 @@ else print ''; print ''; - // Stock min level if ($type != 1 && ! empty($conf->stock->enabled)) { + // Default warehouse + print ''; + // Stock min level print ''; @@ -1351,9 +1358,14 @@ else print ''; // Stock - /* if ($object->isProduct() && ! empty($conf->stock->enabled)) { + // Default warehouse + print ''; + /* print "".''; @@ -1361,7 +1373,9 @@ else print ''; + */ } + /* else { print ''; @@ -1757,6 +1771,17 @@ else print dol_print_url($object->url); print ''; + // Default warehouse + if ($object->isProduct() && ! empty($conf->stock->enabled)) + { + $warehouse = new Entrepot($db); + $warehouse->fetch($object->fk_default_warehouse); + + print ''; + } + //Parent product. if (!empty($conf->variants->enabled) && $object->isProduct()) { diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 6dbf49f69ef..12172342f2a 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -886,6 +886,7 @@ class Product extends CommonObject $sql.= ", surface_units = " . ($this->surface_units!='' ? "'".$this->db->escape($this->surface_units)."'" : 'null'); $sql.= ", volume = " . ($this->volume!='' ? "'".$this->db->escape($this->volume)."'" : 'null'); $sql.= ", volume_units = " . ($this->volume_units!='' ? "'".$this->db->escape($this->volume_units)."'" : 'null'); + $sql.= ", fk_default_warehouse = " . (! empty($this->fk_default_warehouse) ? $this->db->escape($this->fk_default_warehouse) : 'null'); $sql.= ", seuil_stock_alerte = " . ((isset($this->seuil_stock_alerte) && $this->seuil_stock_alerte != '') ? "'".$this->db->escape($this->seuil_stock_alerte)."'" : "null"); $sql.= ", description = '" . $this->db->escape($this->description) ."'"; $sql.= ", url = " . ($this->url?"'".$this->db->escape($this->url)."'":'null'); @@ -1864,7 +1865,7 @@ class Product extends CommonObject $sql = "SELECT rowid, ref, ref_ext, label, description, url, note as note_private, customcode, fk_country, price, price_ttc,"; $sql.= " price_min, price_min_ttc, price_base_type, cost_price, default_vat_code, tva_tx, recuperableonly as tva_npr, localtax1_tx, localtax2_tx, localtax1_type, localtax2_type, tosell,"; - $sql.= " tobuy, fk_product_type, duration, seuil_stock_alerte, canvas, weight, weight_units,"; + $sql.= " tobuy, fk_product_type, duration, fk_default_warehouse, seuil_stock_alerte, canvas, weight, weight_units,"; $sql.= " length, length_units, width, width_units, height, height_units,"; $sql.= " surface, surface_units, volume, volume_units, barcode, fk_barcode_type, finished,"; $sql.= " accountancy_code_buy, accountancy_code_sell, accountancy_code_sell_intra, accountancy_code_sell_export, stock, pmp,"; @@ -1946,6 +1947,7 @@ class Product extends CommonObject $this->accountancy_code_sell_intra = $obj->accountancy_code_sell_intra; $this->accountancy_code_sell_export = $obj->accountancy_code_sell_export; + $this->fk_default_warehouse = $obj->fk_default_warehouse; $this->seuil_stock_alerte = $obj->seuil_stock_alerte; $this->desiredstock = $obj->desiredstock; $this->stock_reel = $obj->stock; diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index d946a23bf70..3d2e1c99e9b 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -70,7 +70,7 @@ if (empty($conf) || ! is_object($conf)) { print ''; print ''; print ''; } if ($object->element == 'stock') diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 32575beb8c7..297ff3e8a56 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -66,7 +66,7 @@ $extrafields = new ExtraFields($db); $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('thirdpartycard','globalcard')); +$hookmanager->initHooks(array('thirdpartycontact','globalcard')); if ($action == 'view' && $object->fetch($socid)<=0) { diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 382a37b9cc3..f3769f9d79e 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1939,6 +1939,16 @@ div.login_block_other { padding-top: 3px; text-align: right; } color: # !important; font-weight: normal !important; } +.login_block_getinfo { + text-align: center; +} +.login_block_getinfo div.login_block_user { + display: block; +} +.login_block_getinfo .atoplogin, .login_block_getinfo .atoplogin:hover { + color: #333 !important; + font-weight: normal !important; +} .alogin, .alogin:hover { font-weight: normal !important; font-size: px !important; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index ae3c08013e1..f1a276bc96d 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1201,6 +1201,16 @@ div.login_block { /* position: initial !important;*/ display: none; } +.login_block_getinfo { + text-align: center; +} +.login_block_getinfo div.login_block_user { + display: block; +} +.login_block_getinfo .atoplogin, .login_block_getinfo .atoplogin:hover { + color: #333 !important; + font-weight: normal !important; +} #id-right { padding-left: 0 ! important; } diff --git a/htdocs/ticketsup/list.php b/htdocs/ticketsup/list.php index d4b5733ef55..0e09333e7dd 100644 --- a/htdocs/ticketsup/list.php +++ b/htdocs/ticketsup/list.php @@ -34,7 +34,7 @@ if (!empty($conf->projet->enabled)) { } // Load traductions files requiredby by page -$langs->loadLangs(array("ticketsup","companies","other")); +$langs->loadLangs(array("ticketsup","companies","other","projects")); // Get parameters @@ -49,10 +49,11 @@ $backtopage = GETPOST('backtopage','alpha'); // Go back to a dedicated $optioncss = GETPOST('optioncss','aZ'); // Option for the css output (always '' except when 'print') $id = GETPOST('id','int'); - $msg_id = GETPOST('msg_id', 'int'); $socid = GETPOST('socid', 'int'); $projectid = GETPOST('projectid', 'int'); +$search_fk_soc=GETPOST('$search_fk_soc','int')?GETPOST('$search_fk_soc','int'):GETPOST('socid','int'); +$search_fk_project=GETPOST('search_fk_project','int')?GETPOST('search_fk_project','int'):GETPOST('projectid','int'); $search_fk_status = GETPOST('search_fk_status', 'alpha'); $mode = GETPOST('mode', 'alpha'); @@ -112,19 +113,10 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab } $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +//if ($socid > 0) $arrayfields['t.fk_soc']['enabled']=0; +//if ($projectid > 0) $arrayfields['t.fk_project']['enabled']=0; -// Filters -// $search_soc = GETPOST("search_soc"); -// $search_fk_status = GETPOST("search_fk_status", 'alpha'); -// $search_subject = GETPOST("search_subject"); -// $search_type = GETPOST("search_type", 'alpha'); -// $search_category = GETPOST("search_category", 'alpha'); -// $search_severity = GETPOST("search_severity", 'alpha'); -// $search_project = GETPOST("search_project", 'int'); -// $search_fk_user_create = GETPOST("search_fk_user_create", 'int'); -// $search_fk_user_assign = GETPOST("search_fk_user_assign", 'int'); - // Security check if (!$user->rights->ticketsup->read) { accessforbidden(); @@ -218,7 +210,8 @@ foreach($search as $key => $val) if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'fk_statut')?2:$mode_search)); } if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); - +if ($search_fk_soc) $sql.= natural_search('fk_soc', $search_fk_soc); +if ($search_fk_project) $sql.= natural_search('fk_project', $search_fk_project); if (!$user->societe_id && ($mode == "my_assign" || (!$user->admin && $conf->global->TICKETS_LIMIT_VIEW_ASSIGNED_ONLY))) { $sql.= " AND t.fk_user_assign=".$user->id; } @@ -336,11 +329,14 @@ if ($socid && !$projectid && $user->rights->societe->lire) { } } -if ($projectid) { +if ($projectid > 0) { $projectstat = new Project($db); if ($projectstat->fetch($projectid) > 0) { $projectstat->fetch_thirdparty(); + $savobject = $object; + $object = $projectstat; + // To verify role of users //$userAccess = $object->restrictedProjectArea($user,'read'); $userWrite = $projectstat->restrictedProjectArea($user, 'write'); @@ -348,55 +344,52 @@ if ($projectid) { //print "userAccess=".$userAccess." userWrite=".$userWrite." userDelete=".$userDelete; $head = project_prepare_head($projectstat); - dol_fiche_head($head, 'ticketsup', $langs->trans("Project"), 0, ($projectstat->public ? 'projectpub' : 'project')); + dol_fiche_head($head, 'ticketsup', $langs->trans("Project"), -1, ($projectstat->public ? 'projectpub' : 'project')); + + // Project card + + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref='
'; + // Title + $morehtmlref.=$object->title; + // Thirdparty + if ($object->thirdparty->id > 0) + { + $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1, 'project'); + } + $morehtmlref.='
'; + + // Define a complementary filter for search of next/prev ref. + if (! $user->rights->projet->all->lire) + { + $objectsListId = $object->getProjectsAuthorizedForUser($user,0,0); + $object->next_prev_filter=" rowid in (".(count($objectsListId)?join(',',array_keys($objectsListId)):'0').")"; + } + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; - /* - * Projet synthese pour rappel - */ print '
'.dol_print_date(dol_mktime(0,0,0,$m,1,$y),"%b %Y").'".price($x_coll)."
 '; - if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0) + if ($modecompta == 'BOOKKEEPING') { - print ''.price(price2num($decaiss_ttc[$case],'MT')).''; - if (! isset($totsorties[$annee])) $totsorties[$annee]=0; - $totsorties[$annee]+=$decaiss_ttc[$case]; + if (isset($decaiss[$case]) && $decaiss[$case] != 0) + { + print ''.price(price2num($decaiss[$case],'MT')).''; + if (! isset($totsorties[$annee])) $totsorties[$annee]=0; + $totsorties[$annee]+=$decaiss[$case]; + } + } + else + { + if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0) + { + print ''.price(price2num($decaiss_ttc[$case],'MT')).''; + if (! isset($totsorties[$annee])) $totsorties[$annee]=0; + $totsorties[$annee]+=$decaiss_ttc[$case]; + } } print " '; - //if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0) - if (isset($encaiss_ttc[$case])) + if ($modecompta == 'BOOKKEEPING') { - print ''.price(price2num($encaiss_ttc[$case],'MT')).''; - if (! isset($totentrees[$annee])) $totentrees[$annee]=0; - $totentrees[$annee]+=$encaiss_ttc[$case]; + if (isset($encaiss[$case])) + { + print ''.price(price2num($encaiss[$case],'MT')).''; + if (! isset($totentrees[$annee])) $totentrees[$annee]=0; + $totentrees[$annee]+=$encaiss[$case]; + } + } + else + { + if (isset($encaiss_ttc[$case])) + { + print ''.price(price2num($encaiss_ttc[$case],'MT')).''; + if (! isset($totentrees[$annee])) $totentrees[$annee]=0; + $totentrees[$annee]+=$encaiss_ttc[$case]; + } } print "
'.$langs->trans("TotalTTC").'
'; +if ($modecompta == 'BOOKKEEPING') print $langs->trans("Total"); +else print $langs->trans("TotalTTC"); +print '
'.$this->attribute_label[$key].'
'.$this->attribute_label[$key].'
'; if (count($listwarehouses) > 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1); + print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 1, 0, $objp->fk_product, '', 1); } elseif (count($listwarehouses) == 1) { - print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix), "entrepot" . $suffix, '', 0, 0, $objp->fk_product, '', 1); + print $formproduct->selectWarehouses(GETPOST("entrepot" . $suffix)?GETPOST("entrepot" . $suffix):($objp->fk_default_warehouse?$objp->fk_default_warehouse:''), "entrepot" . $suffix, '', 0, 0, $objp->fk_product, '', 1); } else { $langs->load("errors"); print $langs->trans("ErrorNoWarehouseDefined"); diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 78ea00f205a..efe029d7adf 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -271,7 +271,7 @@ $sql.= " s.rowid as socid, s.nom as name, s.email, s.town, s.zip, s.fk_pays, s.c $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.= " p.rowid as project_id, p.ref as project_ref"; +$sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label"; // 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 (! $search_all) $sql.= ', SUM(pf.amount) as dynamount_payed'; @@ -925,6 +925,7 @@ if ($resql) { $projectstatic->id=$obj->project_id; $projectstatic->ref=$obj->project_ref; + $projectstatic->title=$obj->project_label; print $projectstatic->getNomUrl(1); } print '
'.$langs->trans("DefaultWarehouse").''; + print $formproduct->selectWarehouses(GETPOST('fk_default_warehouse'), 'fk_default_warehouse', 'warehouseopen', 1); + print ' '.$langs->trans("AddWarehouse").''; + print '
'.$form->textwithpicto($langs->trans("StockLimit"), $langs->trans("StockLimitDesc"), 1).''; print ''; print '
'.$langs->trans("DefaultWarehouse").''; + print $formproduct->selectWarehouses($object->fk_default_warehouse, 'fk_default_warehouse', 'warehouseopen', 1); + print ' '.$langs->trans("AddWarehouse").''; + print '
'.$langs->trans("StockLimit").''; print ''; print ''.$langs->trans("DesiredStock").''; print ''; print '
'.$langs->trans("DefaultWarehouse").''; + print (! empty($warehouse->id) ? $warehouse->getNomUrl(1) : ''); + print ''.$langs->trans("Warehouse").''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1, 0, 0, '', 0, 0, null, 'minwidth100'); print '   '.$langs->trans("WarehouseSource").''; - print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):'ifone')), 'id_entrepot', 'warehouseopen,warehouseinternal', 1); + print $formproduct->selectWarehouses((GETPOST("dwid")?GETPOST("dwid",'int'):(GETPOST('id_entrepot')?GETPOST('id_entrepot','int'):($object->element=='product' && $object->fk_default_warehouse?$object->fk_default_warehouse:'ifone'))), 'id_entrepot', 'warehouseopen,warehouseinternal', 1); print '
'; - $linkback = '' . $langs->trans("BackToList") . ''; - - // Ref - print ''; - - // Label - print ''; - - // Customer - print ""; - print ''; - // Visibility - print ''; - // Statut - print ''; - print "
' . $langs->trans('Ref') . ''; - // Define a complementary filter for search of next/prev ref. - if (!$user->rights->projet->all->lire) { - $objectsListId = $projectstat->getProjectsAuthorizedForUser($user, $mine, 0); - $projectstat->next_prev_filter = " rowid in (" . (count($objectsListId) ? join(',', array_keys($objectsListId)) : '0') . ")"; - } - print $form->showrefnav($projectstat, 'ref', $linkback, 1, 'ref', 'ref', ''); - print '
' . $langs->trans("Label") . '' . $projectstat->title . '
" . $langs->trans("ThirdParty") . "'; - if ($projectstat->thirdparty->id > 0) { - print $projectstat->thirdparty->getNomUrl(1); - } else { - print ' '; - } - - print '
' . $langs->trans("Visibility") . ''; + print '
' . $langs->trans("Visibility") . ''; if ($projectstat->public) { print $langs->trans('SharedProject'); } else { print $langs->trans('PrivateProject'); } - print '
' . $langs->trans("Status") . '' . $projectstat->getLibStatut(4) . '
"; print '
'; + dol_fiche_end(); + + $object = $savobject; + } else { print "ErrorRecordNotFound"; } @@ -414,6 +407,8 @@ foreach($search as $key => $val) if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); // Add $param from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +if ($socid) $param.='&socid='.urlencode($socid); +if ($projectid) $param.='&projectid='.urlencode($projectid); // List of mass actions available $arrayofmassactions = array( @@ -435,6 +430,8 @@ print ''; print ''; print ''; print ''; +if ($socid) print ''; +if ($projectid) print ''; $buttontocreate = '' . $langs->trans('NewTicket') . ''; @@ -456,7 +453,6 @@ if ($sall) print $langs->trans("FilterOnInto", $sall) . join(', ',$fieldstosearchall); } - if ($search_fk_status == 'non_closed') { print '
' . $langs->trans('TicketViewAllTickets') . '
'; $param .= '&search_fk_status=non_closed'; @@ -591,24 +587,24 @@ while ($i < min($num, $limit)) print ''; foreach($object->fields as $key => $val) { - $align=''; - if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; - if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; - if ($key == 'status') $align.=($align?' ':'').'center'; - if (! empty($arrayfields['t.'.$key]['checked'])) - { - print ''; - print $object->showOutputField($val, $key, $obj->$key, ''); - print ''; - if (! $i) $totalarray['nbfield']++; - if (! empty($val['isameasure'])) - { - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; - $totalarray['val']['t.'.$key] += $obj->$key; - } - } + $align=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; + if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; + if ($key == 'status') $align.=($align?' ':'').'center'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + print $object->showOutputField($val, $key, $obj->$key, ''); + print ''; + if (! $i) $totalarray['nbfield']++; + if (! empty($val['isameasure'])) + { + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='t.'.$key; + $totalarray['val']['t.'.$key] += $obj->$key; + } + } } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index bf9ff370e11..c70ab1acf13 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2109,7 +2109,7 @@ class User extends CommonObject * * @param int $withpictoimg Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto, -1=Include photo into link, -2=Only picto photo, -3=Only photo very small) * @param string $option On what the link point to ('leave', 'nolink', ) - * @param integer $infologin Add complete info tooltip + * @param integer $infologin 0=Add default info tooltip, 1=Add complete info tooltip, -1=No info tooltip * @param integer $notooltip 1=Disable tooltip on picto and name * @param int $maxlen Max length of visible user name * @param int $hidethirdpartylogo Hide logo of thirdparty if user is external user @@ -2136,6 +2136,7 @@ class User extends CommonObject $label.= '
'; } + // Info Login $label.= '
'; $label.= '' . $langs->trans("User") . '
'; $label.= '' . $langs->trans('Name') . ': ' . $this->getFullName($langs,''); @@ -2144,20 +2145,18 @@ class User extends CommonObject $label.= '
' . $langs->trans("EMail").': '.$this->email; if (! empty($this->admin)) $label.= '
' . $langs->trans("Administrator").': '.yn($this->admin); - if (! empty($this->societe_id) ) // Add thirdparty for external users + if (! empty($this->socid) ) // Add thirdparty for external users { $thirdpartystatic = new Societe($db); - $thirdpartystatic->fetch($this->societe_id); + $thirdpartystatic->fetch($this->socid); if (empty($hidethirdpartylogo)) $companylink = ' '.$thirdpartystatic->getNomUrl(2, (($option == 'nolink')?'nolink':'')); // picto only of company $company=' ('.$langs->trans("Company").': '.$thirdpartystatic->name.')'; } - $type=($this->societe_id?$langs->trans("External").$company:$langs->trans("Internal")); + $type=($this->socid?$langs->trans("External").$company:$langs->trans("Internal")); $label.= '
' . $langs->trans("Type") . ': ' . $type; $label.= '
' . $langs->trans("Status").': '.$this->getLibStatut(0); $label.='
'; - - // Info Login - if ($infologin) + if ($infologin > 0) { $label.= '
'; $label.= '
'.$langs->trans("Connection").''; @@ -2176,6 +2175,7 @@ class User extends CommonObject if (! empty($conf->browser->phone)) $label.= '
'.$langs->trans("Phone").': '.$conf->browser->phone; if (! empty($_SESSION["disablemodules"])) $label.= '
'.$langs->trans("DisabledModules").':
'.join(', ',explode(',',$_SESSION["disablemodules"])); } + if ($infologin < 0) $label=''; $url = DOL_URL_ROOT.'/user/card.php?id='.$this->id; if ($option == 'leave') $url = DOL_URL_ROOT.'/holiday/list.php?id='.$this->id;