diff --git a/.github/workflows/greetings-pr.yml b/.github/workflows/greetings-pr.yml.disabled similarity index 77% rename from .github/workflows/greetings-pr.yml rename to .github/workflows/greetings-pr.yml.disabled index e8bbb023b38..2a930929a6d 100644 --- a/.github/workflows/greetings-pr.yml +++ b/.github/workflows/greetings-pr.yml.disabled @@ -1,3 +1,4 @@ +# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions name: Greetings PR on: [pull_request] diff --git a/.github/workflows/stale-issues.yml b/.github/workflows/stale-issues.yml index 4d15f84b3f8..66eb3f0cd40 100644 --- a/.github/workflows/stale-issues.yml +++ b/.github/workflows/stale-issues.yml @@ -1,4 +1,6 @@ +# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions name: "Close stale issues (bugs and feature requests)" + on: schedule: - cron: "0 0 * * *" diff --git a/ChangeLog b/ChangeLog index cdcef2d4e4f..f7631b8dc5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,7 +18,7 @@ Following changes may create regressions for some external modules, but were nec * Default mode for GETPOST function is now 'alphanohtml' instead of 'none'. So check when you make POST or GET requests with HTML content that you make a GETPOST('myparam', 'restricthtml') or GETPOST('myparam', 'none') if you really need posted content without sanitizing the HTML into content (in such a case, sanitize data later) - +* Removed hidden constant MAIN_EXTRAFIELDS_IN_ONE_TD that was useless. ***** ChangeLog for 11.0.1 compared to 11.0.0 ***** diff --git a/dev/examples/code/create_invoice.php b/dev/examples/code/create_invoice.php index dbbe9d84c1c..1b212e0a5d7 100755 --- a/dev/examples/code/create_invoice.php +++ b/dev/examples/code/create_invoice.php @@ -66,8 +66,9 @@ $obj = new Facture($db); $obj->ref = 'ABCDE'; $obj->socid = 4; // Put id of third party (rowid in llx_societe table) -$obj->date = mktime(); -$obj->note = 'A comment'; +$obj->date = dol_now(); +$obj->note_public = 'A public comment'; +$obj->note_private = 'A private comment'; $obj->cond_reglement_id = 1; $line1=new FactureLigne($db); diff --git a/dev/examples/code/create_order.php b/dev/examples/code/create_order.php index 30265d5462e..703254ad5e9 100755 --- a/dev/examples/code/create_order.php +++ b/dev/examples/code/create_order.php @@ -66,8 +66,9 @@ $com = new Commande($db); $com->ref = 'ABCDE'; $com->socid = 4; // Put id of third party (rowid in llx_societe table) -$com->date_commande = mktime(); -$com->note = 'A comment'; +$com->date = dol_now(); +$com->note_public = 'A public comment'; +$com->note_private = 'A private comment'; $com->source = 1; $com->remise_percent = 0; diff --git a/dev/setup/codesniffer/ruleset.dtd b/dev/setup/codesniffer/ruleset.dtd index 276626a3a16..24aa32970ea 100644 --- a/dev/setup/codesniffer/ruleset.dtd +++ b/dev/setup/codesniffer/ruleset.dtd @@ -1,13 +1,18 @@ - + + + + - + + + diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 460f815755e..8bd3ff8b319 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -2,6 +2,7 @@ Dolibarr coding standard. + build/html build/aps @@ -188,7 +189,6 @@ - diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index ad0fecf4e33..58dbf20e7bf 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -268,11 +268,11 @@ if ($action != 'export_csv') $displayed_account = ""; $sql = "select t.numero_compte, (SUM(t.debit) - SUM(t.credit)) as opening_balance from ".MAIN_DB_PREFIX."accounting_bookkeeping as t where entity in ".$conf->entity; - $sql.= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte"; + $sql .= " AND t.doc_date < '".$db->idate($search_date_start)."' GROUP BY t.numero_compte"; $resql = $db->query($sql); $nrows = $resql->num_rows; $opening_balances = Array(); - for($i = 0; $i < $nrows; $i++) { + for ($i = 0; $i < $nrows; $i++) { $arr = $resql->fetch_array(); $opening_balances["'".$arr['numero_compte']."'"] = $arr['opening_balance']; } @@ -294,14 +294,14 @@ if ($action != 'export_csv') { // Affiche un Sous-Total par compte comptable if ($displayed_account != "") { - print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; + print ''.$langs->trans("SubTotal").':'.price($sous_total_debit).''.price($sous_total_credit).''.price(price2num($sous_total_credit - $sous_total_debit)).''; print " \n"; print ''; } // Show first line of a break print ''; - print '' . $line->numero_compte . ($root_account_description ? ' - ' . $root_account_description : '') . ''; + print ''.$line->numero_compte.($root_account_description ? ' - '.$root_account_description : '').''; print ''; $displayed_account = $root_account_description; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 8ecef4cde05..847aa3ef47e 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -239,7 +239,7 @@ class AccountancyExport $filename = 'general_ledger-'.$this->getFormatCode($formatexportset); $type_export = 'general_ledger'; - global $db; // The tpl file use $db + global $db; // The tpl file use $db include DOL_DOCUMENT_ROOT.'/accountancy/tpl/export_journal.tpl.php'; @@ -983,7 +983,7 @@ class AccountancyExport $racine_subledger_account = ''; // for records of type E leave this field blank // } - print $racine_subledger_account . $separator; // deprecated CPTG & CPTA use instead + print $racine_subledger_account.$separator; // deprecated CPTG & CPTA use instead // MONT print price(abs($line->montant), 0, '', 1, 2).$separator; // CODC diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index 31eb7c78846..fb957db2233 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -17,7 +17,7 @@ */ // Protection to avoid direct call of template -if (empty($conf) || ! is_object($conf)) +if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit; @@ -29,7 +29,7 @@ $format = $conf->global->ACCOUNTING_EXPORT_FORMAT; $nodateexport = $conf->global->ACCOUNTING_EXPORT_NO_DATE_IN_FILENAME; $siren = $conf->global->MAIN_INFO_SIREN; -$date_export = "_" . dol_print_date(dol_now(), '%Y%m%d%H%M%S'); +$date_export = "_".dol_print_date(dol_now(), '%Y%m%d%H%M%S'); $endaccountingperiod = dol_print_date(dol_now(), '%Y%m%d'); header('Content-Type: text/csv'); @@ -46,22 +46,22 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$ $search_date_end = dol_now(); } $datetouseforfilename = $search_date_end; - $tmparray=dol_getdate($datetouseforfilename); - $fiscalmonth=empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START; + $tmparray = dol_getdate($datetouseforfilename); + $fiscalmonth = empty($conf->global->SOCIETE_FISCAL_MONTH_START) ? 1 : $conf->global->SOCIETE_FISCAL_MONTH_START; // Define end of month to use - if ($tmparray['mon'] <= $fiscalmonth) $tmparray['mon']=$fiscalmonth; + if ($tmparray['mon'] <= $fiscalmonth) $tmparray['mon'] = $fiscalmonth; else { - $tmparray['mon'] = $fiscalmonth; + $tmparray['mon'] = $fiscalmonth; $tmparray['year']++; } $endaccountingperiod = dol_print_date(dol_get_last_day($tmparray['year'], $tmparray['mon']), 'dayxcard'); - $completefilename = $siren . "FEC" . $endaccountingperiod . ".txt"; + $completefilename = $siren."FEC".$endaccountingperiod.".txt"; } else { - $completefilename = ($code?$code . "_":"") . ($prefix?$prefix . "_":"") . $filename . ($nodateexport?"":$date_export) . "." . $format; + $completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format; } -header('Content-Disposition: attachment;filename=' . $completefilename); +header('Content-Disposition: attachment;filename='.$completefilename); diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index e0bde62b10e..af1e6c9bdb4 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -47,7 +47,7 @@ $search_note = GETPOST('search_note', 'alpha'); $search_account = GETPOST('search_account', 'int'); $search_amount = GETPOST('search_amount', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); -$sall=''; +$sall = ''; $date_select = GETPOST("date_select", 'alpha'); @@ -388,16 +388,16 @@ print "\n"; print ''; -if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder); -if (! empty($arrayfields['d.fk_type']['checked'])) print_liste_field_titre($arrayfields['d.fk_type']['label'], $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder); -if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder); -if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder); -if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder); -if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder); -if (! empty($arrayfields['d.bank']['checked'])) print_liste_field_titre($arrayfields['d.bank']['label'], $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder); -if (! empty($arrayfields['c.dateadh']['checked'])) print_liste_field_titre($arrayfields['c.dateadh']['label'], $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall '); -if (! empty($arrayfields['c.datef']['checked'])) print_liste_field_titre($arrayfields['c.datef']['label'], $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall '); -if (! empty($arrayfields['d.amount']['checked'])) print_liste_field_titre($arrayfields['d.amount']['label'], $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right '); +if (!empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'], $_SERVER["PHP_SELF"], "c.rowid", $param, "", "", $sortfield, $sortorder); +if (!empty($arrayfields['d.fk_type']['checked'])) print_liste_field_titre($arrayfields['d.fk_type']['label'], $_SERVER["PHP_SELF"], "c.fk_type", $param, "", "", $sortfield, $sortorder); +if (!empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'], $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder); +if (!empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'], $_SERVER["PHP_SELF"], "d.firstname", $param, "", "", $sortfield, $sortorder); +if (!empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'], $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder); +if (!empty($arrayfields['t.libelle']['checked'])) print_liste_field_titre($arrayfields['t.libelle']['label'], $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder); +if (!empty($arrayfields['d.bank']['checked'])) print_liste_field_titre($arrayfields['d.bank']['label'], $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder); +if (!empty($arrayfields['c.dateadh']['checked'])) print_liste_field_titre($arrayfields['c.dateadh']['label'], $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall '); +if (!empty($arrayfields['c.datef']['checked'])) print_liste_field_titre($arrayfields['c.datef']['label'], $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall '); +if (!empty($arrayfields['d.amount']['checked'])) print_liste_field_titre($arrayfields['d.amount']['label'], $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right '); // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; diff --git a/htdocs/api/admin/explorer.php b/htdocs/api/admin/explorer.php index ac267d29bc3..22263b8b9ba 100644 --- a/htdocs/api/admin/explorer.php +++ b/htdocs/api/admin/explorer.php @@ -25,6 +25,8 @@ * \file htdocs/api/admin/explorer.php */ +use Luracast\Restler\Routes; + require_once '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php'; diff --git a/htdocs/api/admin/index.php b/htdocs/api/admin/index.php index 90bc9acd2fd..45cf082763e 100644 --- a/htdocs/api/admin/index.php +++ b/htdocs/api/admin/index.php @@ -96,7 +96,7 @@ llxHeader(); $linkback = ''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("ApiSetup"), $linkback, 'title_setup'); -print $langs->trans("ApiDesc")."
\n"; +print ''.$langs->trans("ApiDesc")."
\n"; print "
\n"; print '
'; diff --git a/htdocs/blockedlog/admin/blockedlog.php b/htdocs/blockedlog/admin/blockedlog.php index 065dd4cda9e..1ef35942d1e 100644 --- a/htdocs/blockedlog/admin/blockedlog.php +++ b/htdocs/blockedlog/admin/blockedlog.php @@ -28,9 +28,9 @@ require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("admin","other","blockedlog")); +$langs->loadLangs(array("admin", "other", "blockedlog")); -if (! $user->admin || empty($conf->blockedlog->enabled)) accessforbidden(); +if (!$user->admin || empty($conf->blockedlog->enabled)) accessforbidden(); $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); @@ -40,11 +40,12 @@ $backtopage = GETPOST('backtopage', 'alpha'); * Actions */ +$reg = array(); if (preg_match('/set_(.*)/', $action, $reg)) { - $code=$reg[1]; + $code = $reg[1]; $values = GETPOST($code); - if(is_array($values))$values = implode(',', $values); + if (is_array($values)) $values = implode(',', $values); if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0) { @@ -59,7 +60,7 @@ if (preg_match('/set_(.*)/', $action, $reg)) if (preg_match('/del_(.*)/', $action, $reg)) { - $code=$reg[1]; + $code = $reg[1]; if (dolibarr_del_const($db, $code, 0) > 0) { Header("Location: ".$_SERVER["PHP_SELF"]); @@ -76,22 +77,22 @@ if (preg_match('/del_(.*)/', $action, $reg)) * View */ -$form=new Form($db); +$form = new Form($db); $block_static = new BlockedLog($db); llxHeader('', $langs->trans("BlockedLogSetup")); -$linkback=''; +$linkback = ''; if (GETPOST('withtab', 'alpha')) { - $linkback=''.$langs->trans("BackToModuleList").''; + $linkback = ''.$langs->trans("BackToModuleList").''; } print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'), $linkback); if (GETPOST('withtab', 'alpha')) { - $head=blockedlogadmin_prepare_head(); + $head = blockedlogadmin_prepare_head(); dol_fiche_head($head, 'blockedlog', '', -1); } @@ -134,16 +135,16 @@ print ''; print ''; $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite"; -$sql.= " FROM ".MAIN_DB_PREFIX."c_country"; -$sql.= " WHERE active > 0"; +$sql .= " FROM ".MAIN_DB_PREFIX."c_country"; +$sql .= " WHERE active > 0"; -$countryArray=array(); -$resql=$db->query($sql); +$countryArray = array(); +$resql = $db->query($sql); if ($resql) { while ($obj = $db->fetch_object($resql)) { - $countryArray[$obj->code_iso] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso)!="Country".$obj->code_iso?$langs->transnoentitiesnoconv("Country".$obj->code_iso):($obj->label!='-'?$obj->label:'')); + $countryArray[$obj->code_iso] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); } } @@ -159,8 +160,8 @@ print ''; print ''; print ''; print $langs->trans("ListOfTrackedEvents").''; -$arrayoftrackedevents=$block_static->trackedevents; -foreach($arrayoftrackedevents as $key => $val) +$arrayoftrackedevents = $block_static->trackedevents; +foreach ($arrayoftrackedevents as $key => $val) { print $key.' - '.$langs->trans($val).'
'; } diff --git a/htdocs/bom/tpl/objectline_create.tpl.php b/htdocs/bom/tpl/objectline_create.tpl.php index c99e57bcff3..b027b5f397d 100644 --- a/htdocs/bom/tpl/objectline_create.tpl.php +++ b/htdocs/bom/tpl/objectline_create.tpl.php @@ -141,7 +141,7 @@ print ''; print ''; if (is_object($objectline)) { - print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); + print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1); } ?> diff --git a/htdocs/bom/tpl/objectline_edit.tpl.php b/htdocs/bom/tpl/objectline_edit.tpl.php index 17d01e07fd9..10c3ee01e4b 100644 --- a/htdocs/bom/tpl/objectline_edit.tpl.php +++ b/htdocs/bom/tpl/objectline_edit.tpl.php @@ -138,7 +138,7 @@ print ''; print ''; if (is_object($objectline)) { - print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); + print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', 1); } print "\n"; diff --git a/htdocs/bom/tpl/objectline_view.tpl.php b/htdocs/bom/tpl/objectline_view.tpl.php index 16d7d427c75..97221d531ad 100644 --- a/htdocs/bom/tpl/objectline_view.tpl.php +++ b/htdocs/bom/tpl/objectline_view.tpl.php @@ -156,7 +156,7 @@ print ''; //Line extrafield if (!empty($extrafields)) { - print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); + print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1); } print "\n"; diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index 8d772bf5b33..85638a51a45 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -21,132 +21,6 @@ * \brief File with library for bookmark module */ -/** - * Add area with bookmarks in menu - * - * @return string - */ -function printBookmarksList() -{ - global $conf, $user, $db, $langs; - - $ret = ''."\n"; - - if (! empty($conf->use_javascript_ajax)) { // Bookmark autosubmit can't work when javascript is off. - require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; - if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5; - - $langs->load("bookmarks"); - - $url= $_SERVER["PHP_SELF"]; - - if (! empty($_SERVER["QUERY_STRING"])) - { - $url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):''); - } - else - { - global $sortfield,$sortorder; - $tmpurl=''; - // No urlencode, all param $url will be urlencoded later - if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield; - if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder; - if (is_array($_POST)) - { - foreach($_POST as $key => $val) - { - if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val; - } - } - $url.=($tmpurl?'?'.$tmpurl:''); - } - - // Menu bookmark - $ret = ''."\n"; - - $ret.= ''."\n"; - $ret.= ''; - $ret.= ''; - $ret.= ''; - $ret.= '
'; - - $ret.=ajax_combobox('boxbookmark'); - - $ret.=''; - } - - $ret.= ''."\n"; - - return $ret; -} - - /** * Add area with bookmarks in top menu @@ -158,97 +32,89 @@ function printDropdownBookmarksList() global $conf, $user, $db, $langs; require_once DOL_DOCUMENT_ROOT.'/bookmarks/class/bookmark.class.php'; - if (! isset($conf->global->BOOKMARKS_SHOW_IN_MENU)) $conf->global->BOOKMARKS_SHOW_IN_MENU=5; $langs->load("bookmarks"); - $url= $_SERVER["PHP_SELF"]; + $url = $_SERVER["PHP_SELF"]; - if (! empty($_SERVER["QUERY_STRING"])) + if (!empty($_SERVER["QUERY_STRING"])) { - $url.=(dol_escape_htmltag($_SERVER["QUERY_STRING"])?'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]):''); + $url .= (dol_escape_htmltag($_SERVER["QUERY_STRING"]) ? '?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]) : ''); } else { - global $sortfield,$sortorder; - $tmpurl=''; + global $sortfield, $sortorder; + $tmpurl = ''; // No urlencode, all param $url will be urlencoded later - if ($sortfield) $tmpurl.=($tmpurl?'&':'').'sortfield='.$sortfield; - if ($sortorder) $tmpurl.=($tmpurl?'&':'').'sortorder='.$sortorder; + if ($sortfield) $tmpurl .= ($tmpurl ? '&' : '').'sortfield='.$sortfield; + if ($sortorder) $tmpurl .= ($tmpurl ? '&' : '').'sortorder='.$sortorder; if (is_array($_POST)) { - foreach($_POST as $key => $val) + foreach ($_POST as $key => $val) { - if (preg_match('/^search_/', $key) && $val != '') $tmpurl.=($tmpurl?'&':'').$key.'='.$val; + if (preg_match('/^search_/', $key) && $val != '') $tmpurl .= ($tmpurl ? '&' : '').$key.'='.$val; } } - $url.=($tmpurl?'?'.$tmpurl:''); + $url .= ($tmpurl ? '?'.$tmpurl : ''); } $searchForm = ''."\n"; - $searchForm.= '
'; - $searchForm.= ''; - $searchForm.= '
'; + $searchForm .= '
'; + $searchForm .= ''; + $searchForm .= '
'; // Url to list bookmark $listbtn = ''; - $listbtn.= ' '.$langs->trans('Bookmarks').''; + $listbtn .= ' '.$langs->trans('Bookmarks').''; // Url to go on create new bookmark page $newbtn = ''; - if (! empty($user->rights->bookmark->creer)) + if (!empty($user->rights->bookmark->creer)) { //$urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&urlsource='.urlencode($url).'&url='.urlencode($url); - $urltoadd=DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); - $newbtn.= ''; - $newbtn.= img_picto('', 'bookmark').' '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).''; + $urltoadd = DOL_URL_ROOT.'/bookmarks/card.php?action=create&url='.urlencode($url); + $newbtn .= ''; + $newbtn .= img_picto('', 'bookmark').' '.dol_escape_htmltag($langs->trans('AddThisPageToBookmarks')).''; } - - $bookmarkList=''; - $html= ''; - if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) { - $html.= ' + $html = ' '; - } - $html.= ' + $html .= ' '; - $html.= ' + $html .= ' '; - if (! empty($conf->global->BOOKMARKS_SHOW_IN_MENU)) { - $html .= ''; - } return $html; } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 49e5beaa19d..07cd885698e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1070,7 +1070,7 @@ if ($action == 'create') $numproject = $formproject->select_projects((!empty($societe->id) ? $societe->id : -1), $projectid, 'projectid', 0, 0, 1, 1); print ' '; - $urloption = '?action=create'; + $urloption = '?action=create&donotclearsession=1'; $url = dol_buildpath('comm/action/card.php', 2).$urloption; // update task list @@ -1503,7 +1503,7 @@ if ($id > 0) { print ''; - $urloption = '?action=create'; // we use create not edit for more flexibility + $urloption = '?action=create&donotclearsession=1'; // we use create not edit for more flexibility $url = DOL_URL_ROOT.'/comm/action/card.php'.$urloption; // update task list diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index f20197df4dd..0bb38aeaa38 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -4,6 +4,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2019 Nicolas ZABOURI + * Copyright (C) 2020 Pierre Ardoin * * 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 @@ -149,6 +150,9 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) $sql = "SELECT p.rowid, p.ref, p.ref_client, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql .= ", s.code_client"; + $sql .= ", s.email"; + $sql .= ", s.entity"; + $sql .= ", s.code_compta"; $sql .= " FROM ".MAIN_DB_PREFIX."propal as p"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -193,6 +197,9 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas = $obj->canvas; + $companystatic->entity = $obj->entity; + $companystatic->email = $obj->email; + $companystatic->code_compta = $obj->code_compta; print $companystatic->getNomUrl(1, 'customer', 16); print ''; print ''.price($obj->total_ht).''; @@ -233,6 +240,9 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa $sql = "SELECT p.rowid, p.ref, p.total_ht, p.tva as total_tva, p.total as total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql .= ", s.code_client"; + $sql .= ", s.code_fournisseur"; + $sql .= ", s.entity"; + $sql .= ", s.email"; $sql .= " FROM ".MAIN_DB_PREFIX."supplier_proposal as p"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -276,6 +286,8 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas = $obj->canvas; + $companystatic->entity = $obj->entity; + $companystatic->email = $obj->email; print $companystatic->getNomUrl(1, 'supplier', 16); print ''; print ''.price($obj->total_ht).''; @@ -315,6 +327,9 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) $sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql .= ", s.code_client"; + $sql .= ", s.email"; + $sql .= ", s.entity"; + $sql .= ", s.code_compta"; $sql .= " FROM ".MAIN_DB_PREFIX."commande as c"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -358,6 +373,8 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas = $obj->canvas; + $companystatic->email = $obj->email; + $companystatic->entity = $obj->entity; print $companystatic->getNomUrl(1, 'customer', 16); print ''; if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { @@ -404,6 +421,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande- $sql = "SELECT cf.rowid, cf.ref, cf.ref_supplier, cf.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas"; $sql .= ", s.code_client"; $sql .= ", s.code_fournisseur"; + $sql .= ", s.entity"; + $sql .= ", s.email"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as cf"; $sql .= ", ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -447,6 +466,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande- $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas = $obj->canvas; + $companystatic->entity = $obj->entity; + $companystatic->email = $obj->email; print $companystatic->getNomUrl(1, 'supplier', 16); print ''; if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { @@ -496,6 +517,9 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) $sql = "SELECT s.rowid, s.nom as name, s.client, s.datec, s.tms, s.canvas"; $sql .= ", s.code_client"; + $sql .= ", s.code_compta"; + $sql .= ", s.entity"; + $sql .= ", s.email"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE s.client IN (1, 2, 3)"; @@ -532,6 +556,9 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) $companystatic->code_client = $objp->code_client; $companystatic->code_fournisseur = $objp->code_fournisseur; $companystatic->canvas = $objp->canvas; + $companystatic->code_compta = $objp->code_compta; + $companystatic->entity = $objp->entity; + $companystatic->email = $objp->email; print ''; print ''.$companystatic->getNomUrl(1, 'customer', 48).''; print ''; @@ -560,6 +587,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $sql = "SELECT s.nom as name, s.rowid, s.datec as dc, s.canvas, s.tms as dm"; $sql .= ", s.code_fournisseur"; + $sql .= ", s.entity"; + $sql .= ", s.email"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE s.fournisseur = 1"; @@ -591,6 +620,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $companystatic->code_client = $objp->code_client; $companystatic->code_fournisseur = $objp->code_fournisseur; $companystatic->canvas = $objp->canvas; + $companystatic->entity = $objp->entity; + $companystatic->email = $objp->email; print ''; print ''.$companystatic->getNomUrl(1, 'supplier', 44).''; print ''.dol_print_date($db->jdate($objp->dm), 'day').''; @@ -628,7 +659,7 @@ if ($user->rights->agenda->myactions->read) /* - * Last contracts + * Latest contracts */ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TODO A REFAIRE DEPUIS NOUVEAU CONTRAT { @@ -636,7 +667,9 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD $sql = "SELECT s.nom as name, s.rowid, s.canvas, "; $sql .= ", s.code_client"; - $sql .= " c.statut, c.rowid as contratid, p.ref, c.fin_validite as datefin, c.date_cloture as dateclo"; + $sql .= ", s.entity"; + $sql .= ", s.email"; + $sql .= ", c.statut, c.rowid as contratid, p.ref, c.fin_validite as datefin, c.date_cloture as dateclo"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."contrat as c"; $sql .= ", ".MAIN_DB_PREFIX."product as p"; @@ -673,6 +706,8 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD $companystatic->code_client = $objp->code_client; $companystatic->code_fournisseur = $objp->code_fournisseur; $companystatic->canvas = $objp->canvas; + $companystatic->entity = $objp->entity; + $companystatic->email = $objp->email; print $companystatic->getNomUrl(1, 'customer', 44); print ''."\n"; print "".$staticcontrat->LibStatut($obj->statut, 3)."\n"; @@ -697,6 +732,8 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) $langs->load("propal"); $sql = "SELECT s.nom as name, s.rowid, s.code_client"; + $sql .= ", s.entity"; + $sql .= ", s.email"; $sql .= ", p.rowid as propalid, p.entity, p.total as total_ttc, p.total_ht, p.tva as total_tva, p.ref, p.ref_client, p.fk_statut, p.datep as dp, p.fin_validite as dfv"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."propal as p"; @@ -760,6 +797,8 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas = $obj->canvas; + $companystatic->entity = $obj->entity; + $companystatic->email = $obj->email; print $companystatic->getNomUrl(1, 'customer', 44); print ''; print ''; @@ -802,6 +841,8 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) $sql = "SELECT s.nom as name, s.rowid, c.rowid as commandeid, c.total_ttc, c.total_ht, c.tva as total_tva, c.ref, c.ref_client, c.fk_statut, c.date_valid as dv, c.facture as billed"; $sql .= ", s.code_client"; + $sql .= ", s.entity"; + $sql .= ", s.email"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande as c"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; @@ -864,6 +905,8 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) $companystatic->code_client = $obj->code_client; $companystatic->code_fournisseur = $obj->code_fournisseur; $companystatic->canvas = $obj->canvas; + $companystatic->entity = $obj->entity; + $companystatic->email = $obj->email; print $companystatic->getNomUrl(1, 'customer', 44); print ''; print ''; diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 1337c62da94..d0ce31b5369 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -377,8 +377,9 @@ class Proposals extends DolibarrApi * @url DELETE {id}/lines/{lineid} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function deleteLine($id, $lineid) { @@ -417,8 +418,9 @@ class Proposals extends DolibarrApi * @url POST {id}/contact/{contactid}/{type} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function postContact($id, $contactid, $type) { @@ -458,9 +460,10 @@ class Proposals extends DolibarrApi * @url DELETE {id}/contact/{rowid} * * @return int - * @throws 401 - * @throws 404 - * @throws 500 + * + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function deleteContact($id, $rowid) { @@ -629,10 +632,10 @@ class Proposals extends DolibarrApi * * @url POST {id}/validate * - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * * @return array */ diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index d4855e8933f..f5efd124322 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -93,24 +93,24 @@ $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); // Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('ordercard','globalcard')); +$hookmanager->initHooks(array('ordercard', 'globalcard')); $usercanread = $user->rights->commande->lire; $usercancreate = $user->rights->commande->creer; $usercanclose = $user->rights->commande->cloturer; $usercandelete = $user->rights->commande->supprimer; -$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))); -$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler))); +$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->validate))); +$usercancancel = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->commande->order_advance->annuler))); $usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send); $usercancreatepurchaseorder = $user->rights->fournisseur->commande->creer; -$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php -$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $usercancreate; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php /* @@ -1594,25 +1594,25 @@ if ($action == 'create' && $usercancreate) $note_public = $object->getDefaultCreateValueFor('note_public'); } - print '
'; - print ''; + print ''; + print ''; print ''; - print '' . "\n"; - print ''; - print ''; - print ''; - if (!empty($currency_tx)) print ''; + print ''."\n"; + print ''; + print ''; + print ''; + if (!empty($currency_tx)) print ''; dol_fiche_head(''); print ''; // Reference - print ''; + print ''; // Reference client - print ''; else print ''; @@ -2556,7 +2556,7 @@ if ($action == 'create' && $usercancreate) } // Valid - if ($object->statut == Commande::STATUS_DRAFT && ($object->total_ttc >= 0 || ! empty($conf->global->ORDER_ENABLE_NEGATIVE)) && $numlines > 0 && $usercanvalidate) + if ($object->statut == Commande::STATUS_DRAFT && ($object->total_ttc >= 0 || !empty($conf->global->ORDER_ENABLE_NEGATIVE)) && $numlines > 0 && $usercanvalidate) { print ''.$langs->trans('Validate').''; } diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 5069135dd88..60c9e23710b 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -425,8 +425,9 @@ class Orders extends DolibarrApi * @url DELETE {id}/lines/{lineid} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function deleteLine($id, $lineid) { @@ -463,8 +464,9 @@ class Orders extends DolibarrApi * @url POST {id}/contact/{contactid}/{type} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function postContact($id, $contactid, $type) { @@ -499,9 +501,10 @@ class Orders extends DolibarrApi * @url DELETE {id}/contact/{rowid} * * @return int - * @throws 401 - * @throws 404 - * @throws 500 + * + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function deleteContact($id, $rowid) { @@ -617,10 +620,10 @@ class Orders extends DolibarrApi * * @url POST {id}/validate * - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * * @return array */ @@ -670,11 +673,11 @@ class Orders extends DolibarrApi * * @return int * - * @throws 304 - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 304 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function reopen($id) { @@ -709,10 +712,10 @@ class Orders extends DolibarrApi * * @return int * - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function setinvoiced($id) { @@ -849,10 +852,10 @@ class Orders extends DolibarrApi * @url POST /createfromproposal/{proposalid} * * @return int - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function createOrderFromProposal($proposalid) { diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index ac019de8088..18a7eef7b6a 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; -$langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta")); +$langs->loadLangs(array("accountancy", "bills", "companies", "salaries", "compta", "trips")); $date_start = GETPOST('date_start', 'alpha'); $date_startDay = GETPOST('date_startday', 'int'); @@ -77,7 +77,22 @@ if ($user->socid > 0) { accessforbidden(); } -$entity = GETPOST('entity', 'int') ?GETPOST('entity', 'int') : $conf->entity; +// Define $arrayofentities if multientity is set. +$arrayofentities = array(); +if (!empty($conf->multicompany->enabled) && is_object($mc)) { + $arrayofentities = $mc->getEntitiesList(); +} + +$entity = (GETPOSTISSET('entity') ? GETPOST('entity', 'int') : (GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $conf->entity)); +if (!empty($conf->multicompany->enabled) && is_object($mc)) { + if (empty($entity) && !empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) { + $entity = '0,'.join(',', array_keys($arrayofentities)); + } +} +if (empty($entity)) $entity = $conf->entity; + +$error = 0; + /* @@ -103,51 +118,69 @@ if (($action == "searchfiles" || $action == "dl")) { $error++; } + $sql = ''; + if (!$error) { $wheretail = " '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; // Customer invoices - $sql = "SELECT t.rowid as id, t.ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; - $sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; - $sql .= " WHERE datef between ".$wheretail; - $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; - $sql .= " AND t.fk_statut <> ".Facture::STATUS_DRAFT; - $sql .= " UNION ALL"; + if (GETPOST('selectinvoices')) { + if (! empty($sql)) $sql .= " UNION ALL"; + $sql .= "SELECT t.rowid as id, t.entity, t.ref, t.paye as paid, total as total_ht, total_ttc, tva as total_vat, fk_soc, t.datef as date, 'Invoice' as item, s.nom as thirdparty_name, s.code_client as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; + $sql .= " WHERE datef between ".$wheretail; + $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; + $sql .= " AND t.fk_statut <> ".Facture::STATUS_DRAFT; + } // Vendor invoices - $sql .= " SELECT t.rowid as id, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; - $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; - $sql .= " WHERE datef between ".$wheretail; - $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; - $sql .= " AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT; - $sql .= " UNION ALL"; + if (GETPOST('selectsupplierinvoices')) { + if (! empty($sql)) $sql .= " UNION ALL"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, paye as paid, total_ht, total_ttc, total_tva as total_vat, fk_soc, datef as date, 'SupplierInvoice' as item, s.nom as thirdparty_name, s.code_fournisseur as thirdparty_code, c.code as country_code, s.tva_intra as vatnum"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as t LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = t.fk_soc LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = s.fk_pays"; + $sql .= " WHERE datef between ".$wheretail; + $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; + $sql .= " AND t.fk_statut <> ".FactureFournisseur::STATUS_DRAFT; + } // Expense reports - $sql .= " SELECT t.rowid as id, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; - $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; - $sql .= " WHERE date_fin between ".$wheretail; - $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; - $sql .= " AND t.fk_statut <> ".ExpenseReport::STATUS_DRAFT; - $sql .= " UNION ALL"; + if (GETPOST('selectexpensereports')) { + if (! empty($sql)) $sql .= " UNION ALL"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, total_ht, total_ttc, total_tva as total_vat, fk_user_author as fk_soc, date_fin as date, 'ExpenseReport' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user_author LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; + $sql .= " WHERE date_fin between ".$wheretail; + $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; + $sql .= " AND t.fk_statut <> ".ExpenseReport::STATUS_DRAFT; + } // Donations - $sql .= " SELECT t.rowid as id, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; - $sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country"; - $sql .= " WHERE datedon between ".$wheretail; - $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; - $sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT; - $sql .= " UNION ALL"; + if (GETPOST('selectdonations')) { + if (! empty($sql)) $sql .= " UNION ALL"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref, paid, amount as total_ht, amount as total_ttc, 0 as total_vat, 0 as fk_soc, datedon as date, 'Donation' as item, t.societe as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql .= " FROM ".MAIN_DB_PREFIX."don as t LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = t.fk_country"; + $sql .= " WHERE datedon between ".$wheretail; + $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; + $sql .= " AND t.fk_statut <> ".Don::STATUS_DRAFT; + } // Paiements of salaries - $sql .= " SELECT t.rowid as id, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; - $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; - $sql .= " WHERE datep between ".$wheretail; - $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; - //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; - $sql .= " UNION ALL"; + if (GETPOST('selectpaymentsofsalaries')) { + if (! empty($sql)) $sql .= " UNION ALL"; + $sql .= " SELECT t.rowid as id, t.entity, t.ref as ref, 1 as paid, amount as total_ht, amount as total_ttc, 0 as total_vat, t.fk_user as fk_soc, datep as date, 'SalaryPayment' as item, CONCAT(CONCAT(u.lastname, ' '), u.firstname) as thirdparty_name, '' as thirdparty_code, c.code as country_code, '' as vatnum"; + $sql .= " FROM ".MAIN_DB_PREFIX."payment_salary as t LEFT JOIN ".MAIN_DB_PREFIX."user as u ON u.rowid = t.fk_user LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON c.rowid = u.fk_country"; + $sql .= " WHERE datep between ".$wheretail; + $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; + //$sql.=" AND fk_statut <> ".PaymentSalary::STATUS_DRAFT; + } // Social contributions - $sql .= " SELECT t.rowid as id, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum"; - $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t"; - $sql .= " WHERE date_creation between ".$wheretail; - $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; - //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; + if (GETPOST('selectsocialcontributions')) { + if (! empty($sql)) $sql .= " UNION ALL"; + $sql .= " SELECT t.rowid as id, t.entity, t.libelle as ref, paye as paid, amount as total_ht, amount as total_ttc, 0 as total_tva, 0 as fk_soc, date_creation as date, 'SocialContributions' as item, '' as thirdparty_name, '' as thirdparty_code, '' as country_code, '' as vatnum"; + $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as t"; + $sql .= " WHERE date_creation between ".$wheretail; + $sql .= " AND t.entity IN (".($entity == 1 ? '0,1' : $entity).')'; + //$sql.=" AND fk_statut <> ".ChargeSociales::STATUS_DRAFT; + } + } + + if ($sql) { $sql .= $db->order($sortfield, $sortorder); //print $sql; @@ -223,11 +256,11 @@ if (($action == "searchfiles" || $action == "dl")) { $files = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview\.png)$', '', SORT_ASC, 1); //var_dump($upload_dir); //var_dump($files); - if (count($files) < 1) { $nofile = array(); $nofile['id'] = $objd->id; + $nofile['entity'] = $objd->entity; $nofile['date'] = $db->idate($objd->date); $nofile['paid'] = $objd->paid; $nofile['amount_ht'] = $objd->total_ht; @@ -248,6 +281,7 @@ if (($action == "searchfiles" || $action == "dl")) { foreach ($files as $key => $file) { $file['id'] = $objd->id; + $file['entity'] = $objd->entity; $file['date'] = $db->idate($objd->date); $file['paid'] = $objd->paid; $file['amount_ht'] = $objd->total_ht; @@ -288,6 +322,9 @@ if (($action == "searchfiles" || $action == "dl")) { $db->free($resd); } + else { + setEventMessages($langs->trans("ErrorAtLeastOneObjectMustBeSelected"), null, 'errors'); + } } @@ -314,6 +351,10 @@ if ($result && $action == "dl" && !$error) dol_mkdir($dirfortmpfile); $log = $langs->transnoentitiesnoconv("Type"); + if (!empty($conf->multicompany->enabled) && is_object($mc)) + { + $log .= ','.$langs->transnoentitiesnoconv("Entity"); + } $log .= ','.$langs->transnoentitiesnoconv("Date"); $log .= ','.$langs->transnoentitiesnoconv("Ref"); $log .= ','.$langs->transnoentitiesnoconv("TotalHT"); @@ -335,25 +376,30 @@ if ($result && $action == "dl" && !$error) { foreach ($filesarray as $key => $file) { - foreach($file['files'] as $filecursor) { + foreach ($file['files'] as $filecursor) { if (file_exists($filecursor["fullname"])) { $zip->addFile($filecursor["fullname"], $filecursor["relpathnamelang"]); } } - $log .= $file['item']; + $log .= '"'.$langs->trans($file['item']).'"'; + if (!empty($conf->multicompany->enabled) && is_object($mc)) + { + $log .= ',"'.(empty($arrayofentities[$file['entity']]) ? $file['entity'] : $arrayofentities[$file['entity']]).'"'; + } $log .= ','.dol_print_date($file['date'], 'dayrfc'); - $log .= ','.$file['ref']; + $log .= ',"'.$file['ref'].'"'; $log .= ','.$file['amount_ht']; $log .= ','.$file['amount_ttc']; $log .= ','.$file['amount_vat']; $log .= ','.$file['paid']; - $log .= ','.$file["name"]; + $log .= ',"'.$file["name"].'"'; $log .= ','.$file['fk']; - $log .= ','.$file['thirdparty_name']; + $log .= ',"'.$file['thirdparty_name'].'"'; $log .= ','.$file['thirdparty_code']; - $log .= ','.$file['country_code']; - $log .= ',"'.$file['vatnum'].'"'."\n"; + $log .= ',"'.$file['country_code'].'"'; + $log .= ',"'.$file['vatnum'].'"'; + $log .= "\n"; } $zip->addFromString('transactions.csv', $log); $zip->close(); @@ -383,11 +429,13 @@ $form = new Form($db); $userstatic = new User($db); $title = $langs->trans("ComptaFiles").' - '.$langs->trans("List"); +$help_url = ''; llxHeader('', $title, $help_url); $h = 0; -$head[$h][0] = $_SERVER["PHP_SELF"].$varlink; +$head = array(); +$head[$h][0] = $_SERVER["PHP_SELF"]; $head[$h][1] = $langs->trans("AccountantFiles"); $head[$h][2] = 'AccountancyFiles'; @@ -400,16 +448,38 @@ print ''; print $langs->trans("ReportPeriod").': '.$form->selectDate($date_start, 'date_start', 0, 0, 0, "", 1, 1, 0); print ' - '.$form->selectDate($date_stop, 'date_stop', 0, 0, 0, "", 1, 1, 0)."\n"; -// Export is for current company only ! +// Export is for current company only if (!empty($conf->multicompany->enabled) && is_object($mc)) { + $mc->getInfo($conf->entity); print '('.$langs->trans("Entity").' : '; - $mc->dao->getEntities(); - $mc->dao->fetch($conf->entity); - print $mc->dao->label; + print ""; print ")\n"; } +print '
'; + +$listofchoices = array( + 'selectinvoices'=>array('label'=>'Invoices', 'lang'=>'bills'), + 'selectsupplierinvoices'=>array('label'=>'BillsSuppliers', 'lang'=>'bills'), + 'selectexpensereports'=>array('label'=>'ExpenseReports', 'lang'=>'trips'), + 'selectdonations'=>array('label'=>'Donations', 'lang'=>'donation'), + 'selectpaymentsofsalaries'=>array('label'=>'SalariesPayments', 'lang'=>'salaries'), + 'selectsocialcontributions'=>array('label'=>'SocialContributions') +); +foreach($listofchoices as $choice => $val) { + /*if ($val['lang']) { + $langs->load($val['lang']); + }*/ + print '
'.$langs->trans($val['label']).'
'; +} + print ''; print ''."\n"; @@ -433,14 +503,9 @@ if (!empty($date_start) && !empty($date_stop)) print ''; print ''; - - //print ''; - //print ''; - //print ''; - - //print ''; - //print ''; - //print ''; + foreach($listofchoices as $choice => $val) { + print ''; + } print ''; print ''."\n"; @@ -502,9 +567,9 @@ if (!empty($date_start) && !empty($date_stop)) // File link print ''; print ''; print ''; - if($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED )print ''; + if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)print ''; print ''; print ''; print ''; @@ -139,54 +139,54 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // Customer invoices $sql = "SELECT 'invoice' as family, f.rowid as objid, f.ref as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,"; - $sql.= " s.rowid as socid, s.nom as name, s.fournisseur"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; - $sql.= " WHERE f.entity IN (".getEntity('invoice').")"; - $sql.= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid - $sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice - $sql.= " ORDER BY dlr ASC"; + $sql .= " s.rowid as socid, s.nom as name, s.fournisseur"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; + $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; + $sql .= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid + $sql .= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice + $sql .= " ORDER BY dlr ASC"; $sqls[] = $sql; // Supplier invoices $sql = " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; - $sql.= " s.rowid as socid, s.nom as name, s.fournisseur"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; - $sql.= " WHERE ff.entity = ".$conf->entity; - $sql.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid - $sql.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice - $sql.= " ORDER BY dlr ASC"; + $sql .= " s.rowid as socid, s.nom as name, s.fournisseur"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; + $sql .= " WHERE ff.entity = ".$conf->entity; + $sql .= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid + $sql .= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice + $sql .= " ORDER BY dlr ASC"; $sqls[] = $sql; // Social contributions $sql = " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr"; - $sql.= ", cs.fk_account"; - $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id"; - $sql.= " WHERE cs.entity = ".$conf->entity; - $sql.= " AND cs.paye = 0"; // Not paid - $sql.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution - $sql.= " ORDER BY dlr ASC"; + $sql .= ", cs.fk_account"; + $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id"; + $sql .= " WHERE cs.entity = ".$conf->entity; + $sql .= " AND cs.paye = 0"; // Not paid + $sql .= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution + $sql .= " ORDER BY dlr ASC"; $sqls[] = $sql; // others sql $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreSQL', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if(empty($reshook) and isset($hookmanager->resArray['sql'])){ + if (empty($reshook) and isset($hookmanager->resArray['sql'])) { $sqls[] = $hookmanager->resArray['sql']; } - $error=0; - $tab_sqlobjOrder=array(); - $tab_sqlobj=array(); + $error = 0; + $tab_sqlobjOrder = array(); + $tab_sqlobj = array(); - foreach($sqls as $sql){ + foreach ($sqls as $sql) { $resql = $db->query($sql); if ($resql) { while ($sqlobj = $db->fetch_object($resql)) { $tab_sqlobj[] = $sqlobj; - $tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr); + $tab_sqlobjOrder[] = $db->jdate($sqlobj->dlr); } $db->free($resql); } else { @@ -195,13 +195,13 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) } // Sort array - if (! $error) + if (!$error) { array_multisort($tab_sqlobjOrder, $tab_sqlobj); // Apply distinct filter foreach ($tab_sqlobj as $key=>$value) { - $tab_sqlobj[$key] = "'" . serialize($value) . "'"; + $tab_sqlobj[$key] = "'".serialize($value)."'"; } $tab_sqlobj = array_unique($tab_sqlobj); foreach ($tab_sqlobj as $key=>$value) { @@ -221,52 +221,52 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) if ($obj->family == 'invoice_supplier') { - $showline=1; + $showline = 1; // Uncomment this line to avoid to count suppliers credit note (ff.type = 2) //$showline=(($obj->total_ttc < 0 && $obj->type != 2) || ($obj->total_ttc > 0 && $obj->type == 2)) if ($showline) { - $ref=$obj->ref; - $facturefournstatic->ref=$ref; - $facturefournstatic->id=$obj->objid; - $facturefournstatic->type=$obj->type; + $ref = $obj->ref; + $facturefournstatic->ref = $ref; + $facturefournstatic->id = $obj->objid; + $facturefournstatic->type = $obj->type; $ref = $facturefournstatic->getNomUrl(1, ''); $societestatic->id = $obj->socid; $societestatic->name = $obj->name; - $refcomp=$societestatic->getNomUrl(1, '', 24); + $refcomp = $societestatic->getNomUrl(1, '', 24); - $totalpayment = -1*$facturefournstatic->getSommePaiement(); // Payment already done + $totalpayment = -1 * $facturefournstatic->getSommePaiement(); // Payment already done } } if ($obj->family == 'invoice') { - $facturestatic->ref=$obj->ref; - $facturestatic->id=$obj->objid; - $facturestatic->type=$obj->type; + $facturestatic->ref = $obj->ref; + $facturestatic->id = $obj->objid; + $facturestatic->type = $obj->type; $ref = $facturestatic->getNomUrl(1, ''); $societestatic->id = $obj->socid; $societestatic->name = $obj->name; - $refcomp=$societestatic->getNomUrl(1, '', 24); + $refcomp = $societestatic->getNomUrl(1, '', 24); - $totalpayment = $facturestatic->getSommePaiement(); // Payment already done - $totalpayment+= $facturestatic->getSumDepositsUsed(); - $totalpayment+= $facturestatic->getSumCreditNotesUsed(); + $totalpayment = $facturestatic->getSommePaiement(); // Payment already done + $totalpayment += $facturestatic->getSumDepositsUsed(); + $totalpayment += $facturestatic->getSumCreditNotesUsed(); } if ($obj->family == 'social_contribution') { - $socialcontribstatic->ref=$obj->ref; - $socialcontribstatic->id=$obj->objid; - $socialcontribstatic->label=$obj->type; + $socialcontribstatic->ref = $obj->ref; + $socialcontribstatic->id = $obj->objid; + $socialcontribstatic->label = $obj->type; $ref = $socialcontribstatic->getNomUrl(1, 24); - $totalpayment = -1*$socialcontribstatic->getSommePaiement(); // Payment already done + $totalpayment = -1 * $socialcontribstatic->getSommePaiement(); // Payment already done } $parameters = array('obj' => $obj, 'ref' => $ref, 'refcomp' => $refcomp, 'totalpayment' => $totalpayment); $reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if(empty($reshook)){ + if (empty($reshook)) { $ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : $ref; $refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : $refcomp; $totalpayment = isset($hookmanager->resArray['totalpayment']) ? $hookmanager->resArray['totalpayment'] : $totalpayment; @@ -286,11 +286,14 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) else print $langs->trans("NotDefined"); print ""; print ""; - if($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED ){ - if($obj->family == 'invoice'){ + if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED) { + if ($obj->family == 'invoice') { $mc->getInfo($obj->entity); print ""; - }else print ""; + } + else { + print ""; + } } print ""; if ($obj->total_ttc < 0) { print '"; }; @@ -310,7 +313,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // Other lines $parameters = array('solde' => $solde); $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if(empty($reshook)){ + if (empty($reshook)) { print $hookmanager->resPrint; $solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 75e56b580a4..3a36a4b5d70 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -101,6 +101,9 @@ $usehm = (!empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? $conf->global- $object = new Facture($db); $extrafields = new ExtraFields($db); +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + // Load object if ($id > 0 || !empty($ref)) { if ($action != 'add') { @@ -143,6 +146,7 @@ if(empty($conf->global->USE_RETAINED_WARRANTY_ONLY_FOR_SITUATION)) { $RetainedWarrantyInvoiceAvailableType = array( Facture::TYPE_SITUATION ); } + /* * Actions */ diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 7c7437bfb8e..e68966f4663 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -242,10 +242,10 @@ class Invoices extends DolibarrApi * @url POST /createfromorder/{orderid} * * @return int - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function createInvoiceFromOrder($orderid) { @@ -318,10 +318,9 @@ class Invoices extends DolibarrApi * * @return array * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 Invoice not found */ public function putLine($id, $lineid, $request_data = null) { @@ -383,8 +382,9 @@ class Invoices extends DolibarrApi * @url POST {id}/contact/{contactid}/{type} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function postContact($id, $contactid, $type) { @@ -424,9 +424,10 @@ class Invoices extends DolibarrApi * @url DELETE {id}/contact/{rowid} * * @return array - * @throws 401 - * @throws 404 - * @throws 500 + * + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function deleteContact($id, $rowid) { @@ -463,10 +464,10 @@ class Invoices extends DolibarrApi * * @return array * - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function deleteLine($id, $lineid) { @@ -591,10 +592,9 @@ class Invoices extends DolibarrApi * * @return int * - * @throws 200 - * @throws 401 - * @throws 404 - * @throws 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 400 */ public function postLine($id, $request_data = null) { @@ -673,11 +673,10 @@ class Invoices extends DolibarrApi * * @return array * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * */ public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0) @@ -723,11 +722,10 @@ class Invoices extends DolibarrApi * * @return array * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * */ public function settodraft($id, $idwarehouse = -1) @@ -827,11 +825,10 @@ class Invoices extends DolibarrApi * * @return array An invoice object * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function settopaid($id, $close_code = '', $close_note = '') { @@ -878,11 +875,10 @@ class Invoices extends DolibarrApi * * @return array An invoice object * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function settounpaid($id) { @@ -927,11 +923,10 @@ class Invoices extends DolibarrApi * * @return array An invoice object * - * @throws 200 - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function markAsCreditAvailable($id) { @@ -1103,10 +1098,10 @@ class Invoices extends DolibarrApi * @url POST {id}/usediscount/{discountid} * * @return int - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function useDiscount($id, $discountid) { @@ -1149,10 +1144,10 @@ class Invoices extends DolibarrApi * @url POST {id}/usecreditnote/{discountid} * * @return int - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function useCreditNote($id, $discountid) { @@ -1194,10 +1189,11 @@ class Invoices extends DolibarrApi * @url GET {id}/payments * * @return array - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function getPayments($id) { @@ -1243,9 +1239,9 @@ class Invoices extends DolibarrApi * @url POST {id}/payments * * @return int Payment ID - * @throws 400 - * @throws 401 - * @throws 404 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 */ public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') { @@ -1362,10 +1358,10 @@ class Invoices extends DolibarrApi * @url POST /paymentsdistributed * * @return int Payment ID - * @throws 400 - * @throws 401 - * @throws 403 - * @throws 404 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 403 + * @throws RestException 404 */ public function addPaymentDistributed($arrayofamounts, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 135d30ef576..3f4cb94eac3 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1253,6 +1253,14 @@ class Facture extends CommonInvoice $line->date_start = $object->lines[$i]->date_start; $line->date_end = $object->lines[$i]->date_end; + // Multicurrency + $line->fk_multicurrency = $object->lines[$i]->fk_multicurrency; + $line->multicurrency_code = $object->lines[$i]->multicurrency_code; + $line->multicurrency_subprice = $object->lines[$i]->multicurrency_subprice; + $line->multicurrency_total_ht = $object->lines[$i]->multicurrency_total_ht; + $line->multicurrency_total_tva = $object->lines[$i]->multicurrency_total_tva; + $line->multicurrency_total_ttc = $object->lines[$i]->multicurrency_total_ttc; + $line->fk_fournprice = $object->lines[$i]->fk_fournprice; $marginInfos = getMarginInfos($object->lines[$i]->subprice, $object->lines[$i]->remise_percent, $object->lines[$i]->tva_tx, $object->lines[$i]->localtax1_tx, $object->lines[$i]->localtax2_tx, $object->lines[$i]->fk_fournprice, $object->lines[$i]->pa_ht); $line->pa_ht = $marginInfos[0]; @@ -1267,6 +1275,7 @@ class Facture extends CommonInvoice $this->socid = $object->socid; $this->fk_project = $object->fk_project; + $this->fk_account = $object->fk_account; $this->cond_reglement_id = $object->cond_reglement_id; $this->mode_reglement_id = $object->mode_reglement_id; $this->availability_id = $object->availability_id; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index fb2a3edfd9c..3853847c363 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -97,6 +97,8 @@ if (empty($reshook)) $totalpayment = 0; $multicurrency_totalpayment = 0; $atleastonepaymentnotnull = 0; + $formquestion = array(); + $i = 0; // Generate payment array and check if there is payment higher than invoice and payment date before invoice date $tmpinvoice = new Facture($db); @@ -216,7 +218,7 @@ if (empty($reshook)) { $error = 0; - $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); + $datepaye = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); $db->begin(); @@ -262,8 +264,10 @@ if (empty($reshook)) $paiement->amounts = $amounts; // Array with all payments dispatching with invoice id $paiement->multicurrency_amounts = $multicurrency_amounts; // Array with all payments dispatching $paiement->paiementid = dol_getIdFromCode($db, GETPOST('paiementcode'), 'c_paiement', 'code', 'id', 1); - $paiement->num_paiement = GETPOST('num_paiement', 'alpha'); - $paiement->note = GETPOST('comment', 'alpha'); + $paiement->num_payment = GETPOST('num_paiement', 'alpha'); + $paiement->note_private = GETPOST('comment', 'alpha'); + $paiement->num_paiement = $paiement->num_payment; // For bacward compatibility + $paiement->note = $paiement->note_private; // For bacward compatibility if (!$error) { diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index ee443c7b42a..9b0ee645fc7 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -594,43 +594,43 @@ class Paiement extends CommonObject { global $conf, $langs, $user; - $error=0; - $bank_line_id=0; + $error = 0; + $bank_line_id = 0; - if (! empty($conf->banque->enabled)) + if (!empty($conf->banque->enabled)) { if ($accountid <= 0) { - $this->error='Bad value for parameter accountid='.$accountid; + $this->error = 'Bad value for parameter accountid='.$accountid; dol_syslog(get_class($this).'::addPaymentToBank '.$this->error, LOG_ERR); return -1; } $this->db->begin(); - $this->fk_account=$accountid; + $this->fk_account = $accountid; include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; dol_syslog("$user->id, $mode, $label, $this->fk_account, $emetteur_nom, $emetteur_banque"); $acc = new Account($this->db); - $result=$acc->fetch($this->fk_account); + $result = $acc->fetch($this->fk_account); - $totalamount=$this->amount; - if (empty($totalamount)) $totalamount=$this->total; // For backward compatibility + $totalamount = $this->amount; + if (empty($totalamount)) $totalamount = $this->total; // For backward compatibility // if dolibarr currency != bank currency then we received an amount in customer currency (currently I don't manage the case : my currency is USD, the customer currency is EUR and he paid me in GBP. Seems no sense for me) - if (!empty($conf->multicurrency->enabled) && $conf->currency != $acc->currency_code) $totalamount=$this->multicurrency_amount; + if (!empty($conf->multicurrency->enabled) && $conf->currency != $acc->currency_code) $totalamount = $this->multicurrency_amount; - if ($mode == 'payment_supplier') $totalamount=-$totalamount; + if ($mode == 'payment_supplier') $totalamount = -$totalamount; // Insert payment into llx_bank $bank_line_id = $acc->addline( $this->datepaye, - $this->paiementid, // Payment mode id or code ("CHQ or VIR for example") + $this->paiementid, // Payment mode id or code ("CHQ or VIR for example") $label, - $totalamount, // Sign must be positive when we receive money (customer payment), negative when you give money (supplier invoice or credit note) + $totalamount, // Sign must be positive when we receive money (customer payment), negative when you give money (supplier invoice or credit note) $this->num_payment, '', $user, diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index a5279ecbeae..629a73578b2 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -57,7 +57,7 @@ class PaymentSocialContribution extends CommonObject /** * @deprecated - * @see amount + * @see $amount */ public $total; diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index d259fb362fd..54cfcfc37cd 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2016 Frédéric France + * Copyright (C) 2020 Pierre Ardoin * * 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 @@ -29,6 +30,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php' require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsocialcontrib.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +if (!empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page $langs->loadLangs(array('compta', 'banks', 'bills')); @@ -52,6 +54,8 @@ $search_status = GETPOST('search_status', 'int'); $search_day_lim = GETPOST('search_day_lim', 'int'); $search_month_lim = GETPOST('search_month_lim', 'int'); $search_year_lim = GETPOST('search_year_lim', 'int'); +$search_project_ref = GETPOST('search_project_ref', 'alpha'); +$search_project = GETPOST('search_project', 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -88,11 +92,13 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_label = ""; $search_amount = ""; $search_status = ''; - $search_typeid = ""; + $search_typeid = ""; $year = ""; $search_day_lim = ''; $search_year_lim = ''; $search_month_lim = ''; + $search_project_ref = ''; + $search_project = ''; $toselect = ''; $search_array_options = array(); } @@ -106,21 +112,25 @@ $form = new Form($db); $formother = new FormOther($db); $formsocialcontrib = new FormSocialContrib($db); $chargesociale_static = new ChargeSociales($db); +if (!empty($conf->projet->enabled)) $projectstatic = new Project($db); llxHeader('', $langs->trans("SocialContributions")); $sql = "SELECT cs.rowid as id, cs.fk_type as type, "; $sql .= " cs.amount, cs.date_ech, cs.libelle as label, cs.paye, cs.periode,"; +if (!empty($conf->projet->enabled)) $sql .= " p.rowid as project_id, p.ref as project_ref, p.title as project_label,"; $sql .= " c.libelle as type_label,"; $sql .= " SUM(pc.amount) as alreadypayed"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c,"; $sql .= " ".MAIN_DB_PREFIX."chargesociales as cs"; +if (!empty($conf->projet->enabled)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = cs.fk_projet"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."paiementcharge as pc ON pc.fk_charge = cs.rowid"; $sql .= " WHERE cs.fk_type = c.id"; $sql .= " AND cs.entity = ".$conf->entity; // Search criteria if ($search_ref) $sql .= " AND cs.rowid=".$db->escape($search_ref); if ($search_label) $sql .= natural_search("cs.libelle", $search_label); +if (!empty($conf->projet->enabled)) if ($search_project_ref != '') $sql .= natural_search("p.ref", $search_project_ref); if ($search_amount) $sql .= natural_search("cs.amount", $search_amount, 1); if ($search_status != '' && $search_status >= 0) $sql .= " AND cs.paye = ".$db->escape($search_status); $sql .= dolSqlDateFilter("cs.periode", $search_day_lim, $search_month_lim, $search_year_lim); @@ -163,6 +173,7 @@ if ($resql) if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($search_ref) $param .= '&search_ref='.urlencode($search_ref); if ($search_label) $param .= '&search_label='.urlencode($search_label); + if ($search_project_ref >= 0) $param .= "&search_project_ref=".urlencode($search_project_ref); if ($search_amount) $param .= '&search_amount='.urlencode($search_amount); if ($search_typeid) $param .= '&search_typeid='.urlencode($search_typeid); if ($search_status != '' && $search_status != '-1') $param .= '&search_status='.urlencode($search_status); @@ -217,6 +228,8 @@ if ($resql) print ''; + // Ref Project + if (!empty($conf->projet->enabled)) print ''; // Date print ''; // Period end date @@ -245,6 +258,7 @@ if ($resql) print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "id", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "cs.libelle", "", $param, 'class="left"', $sortfield, $sortorder); print_liste_field_titre("Type", $_SERVER["PHP_SELF"], "type", "", $param, 'class="left"', $sortfield, $sortorder); + if (!empty($conf->projet->enabled)) print_liste_field_titre('ProjectRef', $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder); print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "cs.date_ech", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("PeriodEndDate", $_SERVER["PHP_SELF"], "periode", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "cs.amount", "", $param, 'class="right"', $sortfield, $sortorder); @@ -262,6 +276,11 @@ if ($resql) $chargesociale_static->ref = $obj->id; $chargesociale_static->label = $obj->label; $chargesociale_static->type_label = $obj->type_label; + if (!empty($conf->projet->enabled)) { + $projectstatic->id = $obj->project_id; + $projectstatic->ref = $obj->project_ref; + $projectstatic->title = $obj->project_label; + } print ''; @@ -277,6 +296,17 @@ if ($resql) print "\n"; if (!$i) $totalarray['nbfield']++; + // Project Ref + if (!empty($conf->projet->enabled)) { + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Date print ''; if (!$i) $totalarray['nbfield']++; diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 7093a3b7a2f..a1bdfb6678d 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -31,23 +31,23 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Load translation files required by the page -$langs->loadLangs(array("products","categories","errors",'accountancy')); +$langs->loadLangs(array("products", "categories", "errors", 'accountancy')); // Security pack (data & check) $socid = GETPOST('socid', 'int'); if ($user->socid > 0) $socid = $user->socid; -if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user, 'compta', '', '', 'resultat'); -if (! empty($conf->accounting->enabled)) $result=restrictedArea($user, 'accounting', '', '', 'comptarapport'); +if (!empty($conf->comptabilite->enabled)) $result = restrictedArea($user, 'compta', '', '', 'resultat'); +if (!empty($conf->accounting->enabled)) $result = restrictedArea($user, 'accounting', '', '', 'comptarapport'); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') $modecompta = $conf->global->ACCOUNTING_MODE; -if (GETPOST("modecompta")) $modecompta=GETPOST("modecompta"); +if (GETPOST("modecompta")) $modecompta = GETPOST("modecompta"); -$sortorder=isset($_GET["sortorder"])?$_GET["sortorder"]:$_POST["sortorder"]; -$sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; -if (! $sortorder) $sortorder="asc"; -if (! $sortfield) $sortfield="ref"; +$sortorder = isset($_GET["sortorder"]) ? $_GET["sortorder"] : $_POST["sortorder"]; +$sortfield = isset($_GET["sortfield"]) ? $_GET["sortfield"] : $_POST["sortfield"]; +if (!$sortorder) $sortorder = "asc"; +if (!$sortfield) $sortfield = "ref"; // Category $selected_cat = (int) GETPOST('search_categ', 'int'); @@ -58,11 +58,11 @@ if (GETPOST('subcat', 'alpha') === 'yes') { } // product/service $selected_type = GETPOST('search_type', 'int'); -if ($selected_type =='') $selected_type = -1; +if ($selected_type == '') $selected_type = -1; // Date range -$year=GETPOST("year"); -$month=GETPOST("month"); +$year = GETPOST("year"); +$month = GETPOST("month"); $date_startyear = GETPOST("date_startyear"); $date_startmonth = GETPOST("date_startmonth"); $date_startday = GETPOST("date_startday"); @@ -79,51 +79,51 @@ if (empty($year)) $month_current = strftime("%m", dol_now()); $year_start = $year; } -$date_start=dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); -$date_end=dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); +$date_start = dol_mktime(0, 0, 0, GETPOST("date_startmonth"), GETPOST("date_startday"), GETPOST("date_startyear")); +$date_end = dol_mktime(23, 59, 59, GETPOST("date_endmonth"), GETPOST("date_endday"), GETPOST("date_endyear")); // Quarter if (empty($date_start) || empty($date_end)) // We define date_start and date_end { - $q=GETPOST("q", "int"); + $q = GETPOST("q", "int"); if (empty($q)) { // We define date_start and date_end - $month_start=GETPOST("month")?GETPOST("month"):($conf->global->SOCIETE_FISCAL_MONTH_START?($conf->global->SOCIETE_FISCAL_MONTH_START):1); - $year_end=$year_start; - $month_end=$month_start; - if (! GETPOST("month")) // If month not forced + $month_start = GETPOST("month") ?GETPOST("month") : ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); + $year_end = $year_start; + $month_end = $month_start; + if (!GETPOST("month")) // If month not forced { - if (! GETPOST('year') && $month_start > $month_current) + if (!GETPOST('year') && $month_start > $month_current) { $year_start--; $year_end--; } - $month_end=$month_start-1; - if ($month_end < 1) $month_end=12; + $month_end = $month_start - 1; + if ($month_end < 1) $month_end = 12; else $year_end++; } - $date_start=dol_get_first_day($year_start, $month_start, false); $date_end=dol_get_last_day($year_end, $month_end, false); + $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } else { - if ($q==1) { $date_start=dol_get_first_day($year_start, 1, false); $date_end=dol_get_last_day($year_start, 3, false); } - if ($q==2) { $date_start=dol_get_first_day($year_start, 4, false); $date_end=dol_get_last_day($year_start, 6, false); } - if ($q==3) { $date_start=dol_get_first_day($year_start, 7, false); $date_end=dol_get_last_day($year_start, 9, false); } - if ($q==4) { $date_start=dol_get_first_day($year_start, 10, false); $date_end=dol_get_last_day($year_start, 12, false); } + if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } + if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } + if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } + if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); } } } else { // TODO We define q } // $date_start and $date_end are defined. We force $year_start and $nbofyear -$tmps=dol_getdate($date_start); +$tmps = dol_getdate($date_start); $year_start = $tmps['year']; -$tmpe=dol_getdate($date_end); +$tmpe = dol_getdate($date_end); $year_end = $tmpe['year']; $nbofyear = ($year_end - $year_start) + 1; -$commonparams=array(); -if (!empty($modecompta)) $commonparams['modecompta']=$modecompta; +$commonparams = array(); +if (!empty($modecompta)) $commonparams['modecompta'] = $modecompta; if (!empty($sortorder)) $commonparams['sortorder'] = $sortorder; if (!empty($sortfield)) $commonparams['sortfield'] = $sortfield; @@ -142,15 +142,15 @@ $tableparams = array(); if (!empty($selected_cat)) $tableparams['search_categ'] = $selected_cat; if (!empty($selected_soc)) $tableparams['search_soc'] = $selected_soc; if (!empty($selected_type)) $tableparams['search_type'] = $selected_type; -$tableparams['subcat'] = ($subcat === true)?'yes':''; +$tableparams['subcat'] = ($subcat === true) ? 'yes' : ''; // Adding common parameters $allparams = array_merge($commonparams, $headerparams, $tableparams); $headerparams = array_merge($commonparams, $headerparams); $tableparams = array_merge($commonparams, $tableparams); -foreach($allparams as $key => $value) { - $paramslink .= '&' . $key . '=' . $value; +foreach ($allparams as $key => $value) { + $paramslink .= '&'.$key.'='.$value; } @@ -160,127 +160,127 @@ foreach($allparams as $key => $value) { llxHeader(); -$form=new Form($db); +$form = new Form($db); $formother = new FormOther($db); // TODO Report from bookkeeping not yet available, so we switch on report on business events -if ($modecompta=="BOOKKEEPING") $modecompta="CREANCES-DETTES"; -if ($modecompta=="BOOKKEEPINGCOLLECTED") $modecompta="RECETTES-DEPENSES"; +if ($modecompta == "BOOKKEEPING") $modecompta = "CREANCES-DETTES"; +if ($modecompta == "BOOKKEEPINGCOLLECTED") $modecompta = "RECETTES-DEPENSES"; // Show report header -if ($modecompta=="CREANCES-DETTES") { - $name=$langs->trans("Turnover").', '.$langs->trans("ByProductsAndServices"); - $calcmode=$langs->trans("CalcModeDebt"); +if ($modecompta == "CREANCES-DETTES") { + $name = $langs->trans("Turnover").', '.$langs->trans("ByProductsAndServices"); + $calcmode = $langs->trans("CalcModeDebt"); //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; - $description=$langs->trans("RulesCADue"); - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $description.= $langs->trans("DepositsAreNotIncluded"); + $description = $langs->trans("RulesCADue"); + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $description .= $langs->trans("DepositsAreNotIncluded"); } else { - $description.= $langs->trans("DepositsAreIncluded"); + $description .= $langs->trans("DepositsAreIncluded"); } - $builddate=dol_now(); + $builddate = dol_now(); } -elseif ($modecompta=="RECETTES-DEPENSES") +elseif ($modecompta == "RECETTES-DEPENSES") { - $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices"); - $calcmode=$langs->trans("CalcModeEngagement"); + $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices"); + $calcmode = $langs->trans("CalcModeEngagement"); //$calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; - $description=$langs->trans("RulesCAIn"); - $description.= $langs->trans("DepositsAreIncluded"); + $description = $langs->trans("RulesCAIn"); + $description .= $langs->trans("DepositsAreIncluded"); - $builddate=dol_now(); + $builddate = dol_now(); } -elseif ($modecompta=="BOOKKEEPING") +elseif ($modecompta == "BOOKKEEPING") { } -elseif ($modecompta=="BOOKKEEPINGCOLLECTED") +elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } -$period=$form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); -if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink=''.img_previous().''.img_next().''; +$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); +if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink = ''.img_previous().''.img_next().''; else $periodlink = ''; report_header($name, $namelink, $period, $periodlink, $description, $builddate, $exportlink, $tableparams, $calcmode); -if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') +if (!empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING') { print info_admin($langs->trans("WarningReportNotReliable"), 0, 0, 1); } -$name=array(); +$name = array(); // SQL request -$catotal=0; -$catotal_ht=0; -$qtytotal=0; +$catotal = 0; +$catotal_ht = 0; +$qtytotal = 0; if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT DISTINCT p.rowid as rowid, p.ref as ref, p.label as label, p.fk_product_type as product_type,"; - $sql.= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,"; - $sql.= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty"; - $sql.= " FROM ".MAIN_DB_PREFIX."facture as f"; - if($selected_soc > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)"; - $sql.= ",".MAIN_DB_PREFIX."facturedet as l"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid"; + $sql .= " SUM(l.total_ht) as amount, SUM(l.total_ttc) as amount_ttc,"; + $sql .= " SUM(CASE WHEN f.type = 2 THEN -l.qty ELSE l.qty END) as qty"; + $sql .= " FROM ".MAIN_DB_PREFIX."facture as f"; + if ($selected_soc > 0) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as soc ON (soc.rowid = f.fk_soc)"; + $sql .= ",".MAIN_DB_PREFIX."facturedet as l"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON l.fk_product = p.rowid"; if ($selected_cat === -2) // Without any category { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; } elseif ($selected_cat) // Into a specific category { - $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp"; + $sql .= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp"; } - $sql.= " WHERE l.fk_facture = f.rowid"; - $sql.= " AND f.fk_statut in (1,2)"; - if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { - $sql.= " AND f.type IN (0,1,2,5)"; + $sql .= " WHERE l.fk_facture = f.rowid"; + $sql .= " AND f.fk_statut in (1,2)"; + if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { + $sql .= " AND f.type IN (0,1,2,5)"; } else { - $sql.= " AND f.type IN (0,1,2,3,5)"; + $sql .= " AND f.type IN (0,1,2,3,5)"; } if ($date_start && $date_end) { - $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; + $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } - if ($selected_type >=0) + if ($selected_type >= 0) { - $sql.= " AND l.product_type = ".$selected_type; + $sql .= " AND l.product_type = ".$selected_type; } if ($selected_cat === -2) // Without any category { - $sql.=" AND cp.fk_product is null"; + $sql .= " AND cp.fk_product is null"; } elseif ($selected_cat) { // Into a specific category - $sql.= " AND (c.rowid = ".$selected_cat; - if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat; - $sql.= ")"; - $sql.= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid"; + $sql .= " AND (c.rowid = ".$selected_cat; + if ($subcat) $sql .= " OR c.fk_parent = ".$selected_cat; + $sql .= ")"; + $sql .= " AND cp.fk_categorie = c.rowid AND cp.fk_product = p.rowid"; } - if($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; - $sql.= " AND f.entity IN (".getEntity('invoice').")"; - $sql.= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type"; - $sql.= $db->order($sortfield, $sortorder); + if ($selected_soc > 0) $sql .= " AND soc.rowid=".$selected_soc; + $sql .= " AND f.entity IN (".getEntity('invoice').")"; + $sql .= " GROUP BY p.rowid, p.ref, p.label, p.fk_product_type"; + $sql .= $db->order($sortfield, $sortorder); dol_syslog("cabyprodserv", LOG_DEBUG); $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - $i=0; + $i = 0; while ($i < $num) { $obj = $db->fetch_object($result); $amount_ht[$obj->rowid] = $obj->amount; $amount[$obj->rowid] = $obj->amount_ttc; $qty[$obj->rowid] = $obj->qty; - $name[$obj->rowid] = $obj->ref . ' - ' . $obj->label; + $name[$obj->rowid] = $obj->ref.' - '.$obj->label; $type[$obj->rowid] = $obj->product_type; - $catotal_ht+=$obj->amount; - $catotal+=$obj->amount_ttc; - $qtytotal+=$obj->qty; + $catotal_ht += $obj->amount; + $catotal += $obj->amount_ttc; + $qtytotal += $obj->qty; $i++; } } else { @@ -288,25 +288,25 @@ if ($modecompta == 'CREANCES-DETTES') } // Show Array - $i=0; + $i = 0; print ''; // Extra parameters management - foreach($headerparams as $key => $value) + foreach ($headerparams as $key => $value) { print ''; } - $moreforfilter=''; + $moreforfilter = ''; print '
'; - print '
' . $langs->trans('Ref') . '' . $langs->trans("Draft") . '
'.$langs->trans('Ref').''.$langs->trans("Draft").'
' . $langs->trans('RefCustomer') . ''; - if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER) && ! empty($origin) && ! empty($originid)) + print '
'.$langs->trans('RefCustomer').''; + if (!empty($conf->global->MAIN_USE_PROPAL_REFCLIENT_FOR_ORDER) && !empty($origin) && !empty($originid)) print '"; + if (!empty($conf->global->MULTICOMPANY_ALLOW_EXPORT_ACCOUNTING_DOC_FOR_ALL_ENTITIES)) { + print $mc->select_entities(GETPOSTISSET('search_entity') ? GETPOST('search_entity', 'int') : $mc->id, 'search_entity', '', false, false, false, false, true); + } else { + print $mc->label; + } + print "'; - if (! empty($data['files'])) + if (!empty($data['files'])) { - foreach($data['files'] as $filecursor) { + foreach ($data['files'] as $filecursor) { print ''.($filecursor['name'] ? $filecursor['name'] : $filecursor['ref']).'
'; } } diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 2ecb59861d9..1272cfcad85 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -183,10 +183,10 @@ class BankAccounts extends DolibarrApi * * @status 201 * - * @throws 401 Unauthorized: User does not have permission to configure bank accounts - * @throws 404 Not Found: Either the source or the destination bankaccount for the provided id does not exist - * @throws 422 Unprocessable Entity: Refer to detailed exception message for the cause - * @throws 500 Internal Server Error: Error(s) returned by the RDBMS + * @throws RestException 401 Unauthorized: User does not have permission to configure bank accounts + * @throws RestException 404 Not Found: Either the source or the destination bankaccount for the provided id does not exist + * @throws RestException 422 Unprocessable Entity: Refer to detailed exception message for the cause + * @throws RestException 500 Internal Server Error: Error(s) returned by the RDBMS */ public function transfer($bankaccount_from_id = 0, $bankaccount_to_id = 0, $date = null, $description = "", $amount = 0.0, $amount_to = 0.0) { diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 7ca62b67ab8..b8d259cdc8d 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -39,18 +39,18 @@ $langs->loadLangs(array('banks', 'categories', 'bills', 'companies')); // Security check if (isset($_GET["account"]) || isset($_GET["ref"])) { - $id = isset($_GET["account"])?$_GET["account"]:(isset($_GET["ref"])?$_GET["ref"]:''); + $id = isset($_GET["account"]) ? $_GET["account"] : (isset($_GET["ref"]) ? $_GET["ref"] : ''); } -$fieldid = isset($_GET["ref"])?'ref':'rowid'; -if ($user->socid) $socid=$user->socid; -$result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid); +$fieldid = isset($_GET["ref"]) ? 'ref' : 'rowid'; +if ($user->socid) $socid = $user->socid; +$result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid); -$vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"]; -$page=isset($_GET["page"])?$_GET["page"]:0; +$vline = isset($_GET["vline"]) ? $_GET["vline"] : $_POST["vline"]; +$page = isset($_GET["page"]) ? $_GET["page"] : 0; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('banktreso','globalcard')); +$hookmanager->initHooks(array('banktreso', 'globalcard')); /* * View @@ -61,9 +61,9 @@ $helpurl = ""; llxHeader('', $title, $helpurl); $societestatic = new Societe($db); -$facturestatic=new Facture($db); -$facturefournstatic=new FactureFournisseur($db); -$socialcontribstatic=new ChargeSociales($db); +$facturestatic = new Facture($db); +$facturefournstatic = new FactureFournisseur($db); +$socialcontribstatic = new ChargeSociales($db); $form = new Form($db); @@ -81,17 +81,17 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $object = new Account($db); if ($_GET["account"]) { - $result=$object->fetch($_GET["account"]); + $result = $object->fetch($_GET["account"]); } if ($_GET["ref"]) { - $result=$object->fetch(0, $_GET["ref"]); - $_GET["account"]=$object->id; + $result = $object->fetch(0, $_GET["ref"]); + $_GET["account"] = $object->id; } // Onglets - $head=bank_prepare_head($object); + $head = bank_prepare_head($object); dol_fiche_head($head, 'cash', $langs->trans("FinancialAccount"), 0, 'account'); $linkback = ''.$langs->trans("BackToList").''; @@ -103,7 +103,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) print '
'; $solde = $object->solde(0); - if($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)$colspan = 6; + if ($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED)$colspan = 6; else $colspan = 5; // Show next coming entries @@ -114,7 +114,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) print '
'.$langs->trans("DateDue").''.$langs->trans("Description").''.$langs->trans("Entity").''.$langs->trans("Entity").''.$langs->trans("ThirdParty").''.$langs->trans("Debit").''.$langs->trans("Credit").'".$ref."".$mc->label."".$refcomp."'.price(abs($total_ttc))." '; $formsocialcontrib->select_type_socialcontrib($search_typeid, 'search_typeid', 1, 0, 0, 'maxwidth100onsmartphone'); print ' 
".$obj->type_label."'; + if ($obj->project_id > 0) + { + print $projectstatic->getNomUrl(1); + } + print ''.dol_print_date($db->jdate($obj->date_ech), 'day').'
'."\n"; + print '
'."\n"; // Category filter print ''; print ''; print '\n"; if (count($name)) { - foreach($name as $key=>$value) { + foreach ($name as $key=>$value) { print ''; // Product print "\n"; @@ -465,7 +465,7 @@ if ($modecompta == 'CREANCES-DETTES') // "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an // invoice with 2 product (product A for 10 euros and product B for 20 euros), what is part of paiment for product A and part of paiment for product B ? // Because there is no way to know this, this report is not relevant. - print '
'.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant") . '
'; + print '
'.$langs->trans("TurnoverPerProductInCommitmentAccountingNotRelevant").'
'; } // End of page diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 684ef337fcd..9be5607b62d 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -407,7 +407,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) print ""; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - $casenow = dol_print_date(mktime(),"%Y-%m"); + $casenow = dol_print_date(dol_now(),"%Y-%m"); $case = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee),"%Y-%m"); $caseprev = dol_print_date(dol_mktime(1,1,1,$mois,1,$annee-1),"%Y-%m"); diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index bc680c5250a..73862b65b2e 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -554,6 +554,8 @@ else setEventMessages($object->error, $object->errors, 'errors'); } + $object->fetchRoles(); + // Show tabs $head = contact_prepare_head($object); @@ -580,7 +582,7 @@ else $object->country = $tmparray['label']; } - $title = $addcontact = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); + $title = (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT) ? $langs->trans("AddContact") : $langs->trans("AddContactAddress")); $linkback = ''; print load_fiche_titre($title, $linkback, 'address'); @@ -654,7 +656,7 @@ else // Civility print ''; print ''; @@ -683,13 +685,13 @@ else if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->zip)) == 0) $object->zip = $objsoc->zip; // Predefined with third party if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->town)) == 0) $object->town = $objsoc->town; // Predefined with third party print ''; // Country print ''; @@ -707,7 +709,7 @@ else if ($object->country_id) { - print $formcompany->select_state(GETPOST("state_id", 'alpha') ?GETPOST("state_id", 'alpha') : $object->state_id, $object->country_code, 'state_id'); + print $formcompany->select_state(GETPOST("state_id", 'alpha') ? GETPOST("state_id", 'alpha') : $object->state_id, $object->country_code, 'state_id'); } else { @@ -721,23 +723,23 @@ else // Phone / Fax print ''; - print ''; + print ''; if ($conf->browser->layout == 'phone') print ''; print ''; - print ''; + print ''; print ''; - print ''; + print ''; if ($conf->browser->layout == 'phone') print ''; print ''; - print ''; + print ''; print ''; if (($objsoc->typent_code == 'TE_PRIVATE' || !empty($conf->global->CONTACT_USE_COMPANY_ADDRESS)) && dol_strlen(trim($object->email)) == 0) $object->email = $objsoc->email; // Predefined with third party // Email print ''; - print ''; + print ''; print ''; if (!empty($conf->mailing->enabled)) @@ -757,7 +759,7 @@ else print ''; print ''; - print ''; + print ''; print ''; } print ''; diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 16279187b97..8d880226ff4 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -314,9 +314,9 @@ class Contact extends CommonObject // Clean parameters $this->lastname = $this->lastname ?trim($this->lastname) : trim($this->name); $this->firstname = trim($this->firstname); - if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords($this->lastname); + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords(strtolower($this->lastname)); if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = strtoupper($this->lastname); - if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords($this->firstname); + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords(strtolower($this->firstname)); if (empty($this->socid)) $this->socid = 0; if (empty($this->priv)) $this->priv = 0; if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request @@ -427,9 +427,9 @@ class Contact extends CommonObject $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); // Clean parameters - if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords($this->lastname); + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname = ucwords(strtolower($this->lastname)); if (!empty($conf->global->MAIN_ALL_TO_UPPER)) $this->lastname = strtoupper($this->lastname); - if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords($this->firstname); + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname = ucwords(strtolower($this->firstname)); $this->lastname = trim($this->lastname) ?trim($this->lastname) : trim($this->lastname); $this->firstname = trim($this->firstname); @@ -802,20 +802,19 @@ class Contact extends CommonObject /** - * Load object contact + * Load object contact. * - * @param int $id id du contact - * @param User $user Utilisateur (abonnes aux alertes) qui veut les alertes de ce contact - * @param string $ref_ext External reference, not given by Dolibarr - * @param string $email Email - * @return int -1 if KO, 0 if OK but not found, 1 if OK + * @param int $id Id of contact + * @param User $user Load also alerts of this user (subscribing to alerts) that want alerts about this contact + * @param string $ref_ext External reference, not given by Dolibarr + * @param string $email Email + * @param int $loadalsoroles Load also roles + * @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found. */ - public function fetch($id, $user = null, $ref_ext = '', $email = '') + public function fetch($id, $user = null, $ref_ext = '', $email = '', $loadalsoroles = 0) { global $langs; - $langs->load("dict"); - dol_syslog(get_class($this)."::fetch id=".$id." ref_ext=".$ref_ext." email=".$email, LOG_DEBUG); if (empty($id) && empty($ref_ext) && empty($email)) @@ -824,7 +823,7 @@ class Contact extends CommonObject return -1; } - $langs->load("companies"); + $langs->loadLangs(array("dict", "companies")); $sql = "SELECT c.rowid, c.entity, c.fk_soc, c.ref_ext, c.civility as civility_code, c.lastname, c.firstname,"; $sql .= " c.address, c.statut, c.zip, c.town,"; @@ -861,7 +860,15 @@ class Contact extends CommonObject $resql = $this->db->query($sql); if ($resql) { - if ($this->db->num_rows($resql)) + $num = $this->db->num_rows($resql); + if ($num > 1) + { + $this->error = 'Fetch found several records. Rename one of contact to avoid duplicate.'; + dol_syslog($this->error, LOG_ERR); + + return 2; + } + elseif ($num) // $num = 1 { $obj = $this->db->fetch_object($resql); @@ -942,7 +949,11 @@ class Contact extends CommonObject return -1; } - // Charge alertes du user + // Retreive all extrafield + // fetch optionals attributes and labels + $this->fetch_optionals(); + + // Load also alerts of this user if ($user) { $sql = "SELECT fk_user"; @@ -967,13 +978,12 @@ class Contact extends CommonObject } } - // Retreive all extrafield - // fetch optionals attributes and labels - $this->fetch_optionals(); - - $resultRole = $this->fetchRoles(); - if ($resultRole < 0) { - return $resultRole; + // Load also roles of this address + if ($loadalsoroles) { + $resultRole = $this->fetchRoles(); + if ($resultRole < 0) { + return $resultRole; + } } return 1; @@ -1587,7 +1597,7 @@ class Contact extends CommonObject } /** - * Fetch Role for a contact + * Fetch Roles for a contact * * @return float|int * @throws Exception @@ -1599,7 +1609,7 @@ class Contact extends CommonObject $num = 0; $sql = "SELECT tc.rowid, tc.element, tc.source, tc.code, tc.libelle, sc.rowid as contactroleid"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe_contacts as sc "; + $sql .= " FROM ".MAIN_DB_PREFIX."societe_contacts as sc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql .= " ON tc.rowid = sc.fk_c_type_contact"; $sql .= " AND sc.fk_socpeople = ".$this->id; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 1fc63769af3..4e0e5cb5865 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -1704,7 +1704,7 @@ else if (is_array($extralabelslines) && count($extralabelslines) > 0) { $line = new ContratLigne($db); $line->fetch_optionals($objp->rowid); - print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); + print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1); } } // Line in mode update @@ -1794,7 +1794,7 @@ else if (is_array($extralabelslines) && count($extralabelslines) > 0) { $line = new ContratLigne($db); $line->fetch_optionals($objp->rowid); - print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); + print $line->showOptionals($extrafields, 'edit', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', 1); } } diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 9d201d6fef1..71458e76050 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -439,8 +439,9 @@ class Contracts extends DolibarrApi * @url DELETE {id}/lines/{lineid} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function deleteLine($id, $lineid) { diff --git a/htdocs/contrat/tpl/linkedobjectblock.tpl.php b/htdocs/contrat/tpl/linkedobjectblock.tpl.php index b7ec9574ccb..b200baef726 100644 --- a/htdocs/contrat/tpl/linkedobjectblock.tpl.php +++ b/htdocs/contrat/tpl/linkedobjectblock.tpl.php @@ -63,7 +63,7 @@ foreach($linkedObjectBlock as $key => $objectlink) echo price($totalcontrat); } ?> - + db = $db; // disable box for such cases - if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled=0; // disabled by this option + if (!empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $this->enabled = 0; // disabled by this option - $this->hidden = ! ($user->rights->societe->lire && empty($user->socid)); + $this->hidden = !($user->rights->societe->lire && empty($user->socid)); } /** @@ -77,33 +77,33 @@ class box_clients extends ModeleBoxes global $user, $langs, $conf; $langs->load("boxes"); - $this->max=$max; + $this->max = $max; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $thirdpartystatic=new Societe($this->db); + $thirdpartystatic = new Societe($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedCustomers", $max)); if ($user->rights->societe->lire) { $sql = "SELECT s.nom as name, s.rowid as socid"; - $sql.= ", s.code_client"; - $sql.= ", s.client"; - $sql.= ", s.code_fournisseur"; - $sql.= ", s.fournisseur"; - $sql.= ", s.code_compta"; - $sql.= ", s.code_compta_fournisseur"; - $sql.= ", s.logo"; - $sql.= ", s.email"; - $sql.= ", s.datec, s.tms, s.status"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE s.client IN (1, 3)"; - $sql.= " AND s.entity IN (".getEntity('societe').")"; - if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($user->socid) $sql.= " AND s.rowid = $user->socid"; - $sql.= " ORDER BY s.tms DESC"; - $sql.= $this->db->plimit($max, 0); + $sql .= ", s.code_client"; + $sql .= ", s.client"; + $sql .= ", s.code_fournisseur"; + $sql .= ", s.fournisseur"; + $sql .= ", s.code_compta"; + $sql .= ", s.code_compta_fournisseur"; + $sql .= ", s.logo"; + $sql .= ", s.email"; + $sql .= ", s.datec, s.tms, s.status, s.entity"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql .= " WHERE s.client IN (1, 3)"; + $sql .= " AND s.entity IN (".getEntity('societe').")"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + if ($user->socid) $sql .= " AND s.rowid = $user->socid"; + $sql .= " ORDER BY s.tms DESC"; + $sql .= $this->db->plimit($max, 0); dol_syslog(get_class($this)."::loadBox", LOG_DEBUG); $result = $this->db->query($sql); @@ -115,8 +115,8 @@ class box_clients extends ModeleBoxes while ($line < $num) { $objp = $this->db->fetch_object($result); - $datec=$this->db->jdate($objp->datec); - $datem=$this->db->jdate($objp->tms); + $datec = $this->db->jdate($objp->datec); + $datem = $this->db->jdate($objp->tms); $thirdpartystatic->id = $objp->socid; $thirdpartystatic->name = $objp->name; $thirdpartystatic->code_client = $objp->code_client; @@ -127,6 +127,7 @@ class box_clients extends ModeleBoxes $thirdpartystatic->fournisseur = $objp->fournisseur; $thirdpartystatic->logo = $objp->logo; $thirdpartystatic->email = $objp->email; + $thirdpartystatic->entity = $objp->entity; $this->info_box_contents[$line][] = array( 'td' => '', @@ -147,7 +148,7 @@ class box_clients extends ModeleBoxes $line++; } - if ($num==0) $this->info_box_contents[$line][0] = array('td' => 'class="center"','text'=>$langs->trans("NoRecordedCustomers")); + if ($num == 0) $this->info_box_contents[$line][0] = array('td' => 'class="center"', 'text'=>$langs->trans("NoRecordedCustomers")); $this->db->free($result); } diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index 5f26351affe..2f55a379362 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -2,6 +2,7 @@ /* Copyright (C) 2004-2006 Destailleur Laurent * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2019 Frederic France + * Copyright (C) 2020 Pierre Ardoin * * 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 @@ -31,9 +32,9 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; */ class box_fournisseurs extends ModeleBoxes { - public $boxcode="lastsuppliers"; - public $boximg="object_company"; - public $boxlabel="BoxLastSuppliers"; + public $boxcode = "lastsuppliers"; + public $boximg = "object_company"; + public $boxlabel = "BoxLastSuppliers"; public $depends = array("fournisseur"); /** @@ -59,7 +60,7 @@ class box_fournisseurs extends ModeleBoxes $this->db = $db; - $this->hidden = ! ($user->rights->societe->lire && empty($user->socid)); + $this->hidden = !($user->rights->societe->lire && empty($user->socid)); } /** @@ -73,28 +74,28 @@ class box_fournisseurs extends ModeleBoxes global $conf, $user, $langs; $langs->load("boxes"); - $this->max=$max; + $this->max = $max; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $thirdpartystatic=new Societe($this->db); + $thirdpartystatic = new Societe($this->db); include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php'; - $thirdpartytmp=new Fournisseur($this->db); + $thirdpartytmp = new Fournisseur($this->db); $this->info_box_head = array('text' => $langs->trans("BoxTitleLastModifiedSuppliers", $max)); if ($user->rights->societe->lire) { $sql = "SELECT s.nom as name, s.rowid as socid, s.datec, s.tms, s.status,"; - $sql.= " s.code_fournisseur, s.email as semail,"; - $sql.= " s.logo"; + $sql .= " s.code_fournisseur, s.email as semail,"; + $sql .= " s.logo, s.code_compta_fournisseur, s.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; - if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE s.fournisseur = 1"; - $sql.= " AND s.entity IN (".getEntity('societe').")"; - if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($user->socid) $sql.= " AND s.rowid = ".$user->socid; - $sql.= " ORDER BY s.tms DESC "; - $sql.= $this->db->plimit($max, 0); + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql .= " WHERE s.fournisseur = 1"; + $sql .= " AND s.entity IN (".getEntity('societe').")"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; + $sql .= " ORDER BY s.tms DESC "; + $sql .= $this->db->plimit($max, 0); $result = $this->db->query($sql); if ($result) @@ -105,13 +106,15 @@ class box_fournisseurs extends ModeleBoxes while ($line < $num) { $objp = $this->db->fetch_object($result); - $datec=$this->db->jdate($objp->datec); - $datem=$this->db->jdate($objp->tms); + $datec = $this->db->jdate($objp->datec); + $datem = $this->db->jdate($objp->tms); $thirdpartytmp->id = $objp->socid; $thirdpartytmp->name = $objp->name; $thirdpartytmp->email = $objp->semail; $thirdpartytmp->code_client = $objp->code_client; $thirdpartytmp->logo = $objp->logo; + $thirdpartytmp->code_compta_fournisseur = $objp->code_compta_fournisseur; + $thirdpartytmp->entity = $objp->entity; $this->info_box_contents[$line][] = array( 'td' => '', @@ -132,7 +135,7 @@ class box_fournisseurs extends ModeleBoxes $line++; } - if ($num==0) $this->info_box_contents[$line][0] = array( + if ($num == 0) $this->info_box_contents[$line][0] = array( 'td' => 'class="center"', 'text'=>$langs->trans("NoRecordedSuppliers"), ); diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 0bc6d801e41..9fffc92963f 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -96,7 +96,7 @@ class box_project extends ModeleBoxes $projectsListId=''; if (! $user->rights->projet->all->lire) $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1, $socid); - $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut, p.public"; + $sql = "SELECT p.rowid, p.ref, p.title, p.fk_statut as status, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; $sql.= " WHERE p.entity IN (".getEntity('project').")"; // Only current entity or severals if permission ok $sql.= " AND p.fk_statut = 1"; // Only open projects @@ -117,6 +117,7 @@ class box_project extends ModeleBoxes $projectstatic->ref = $objp->ref; $projectstatic->title = $objp->title; $projectstatic->public = $objp->public; + $projectstatic->statut = $objp->status; $this->info_box_contents[$i][] = array( 'td' => 'class="nowraponall"', @@ -152,6 +153,7 @@ class box_project extends ModeleBoxes $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => round(0)); $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => "N/A "); } + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => $projectstatic->getLibStatut(3)); $i++; } @@ -166,22 +168,26 @@ class box_project extends ModeleBoxes // Add the sum à the bottom of the boxes $this->info_box_contents[$i][] = array( - 'td' => '', + 'td' => 'class="liste_total"', 'text' => $langs->trans("Total")." ".$textHead, 'text' => " ", ); $this->info_box_contents[$i][] = array( - 'td' => 'class="right" ', + 'td' => 'class="right liste_total" ', 'text' => round($num, 0)." ".$langs->trans("Projects"), ); $this->info_box_contents[$i][] = array( - 'td' => 'class="right" ', + 'td' => 'class="right liste_total" ', 'text' => (($max < $num) ? '' : (round($totalnbTask, 0)." ".$langs->trans("Tasks"))), ); $this->info_box_contents[$i][] = array( - 'td' => '', + 'td' => 'class="liste_total"', 'text' => " ", ); + $this->info_box_contents[$i][] = array( + 'td' => 'class="liste_total"', + 'text' => " ", + ); } /** diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 3cbd9f45514..979723753a0 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2015-2019 Frederic France + * Copyright (C) 2020 Pierre Ardoin * * 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 @@ -32,10 +33,10 @@ include_once DOL_DOCUMENT_ROOT.'/core/boxes/modules_boxes.php'; */ class box_propales extends ModeleBoxes { - public $boxcode="lastpropals"; - public $boximg="object_propal"; - public $boxlabel="BoxLastProposals"; - public $depends = array("propal"); // conf->propal->enabled + public $boxcode = "lastpropals"; + public $boximg = "object_propal"; + public $boxlabel = "BoxLastProposals"; + public $depends = array("propal"); // conf->propal->enabled /** * @var DoliDB Database handler. @@ -60,7 +61,7 @@ class box_propales extends ModeleBoxes $this->db = $db; - $this->hidden = ! ($user->rights->propale->lire); + $this->hidden = !($user->rights->propale->lire); } /** @@ -73,45 +74,45 @@ class box_propales extends ModeleBoxes { global $user, $langs, $conf; - $this->max=$max; + $this->max = $max; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; - $propalstatic=new Propal($this->db); + $propalstatic = new Propal($this->db); $societestatic = new Societe($this->db); - $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE?"":"Modified")."Propals", $max)); + $this->info_box_head = array('text' => $langs->trans("BoxTitleLast".($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE ? "" : "Modified")."Propals", $max)); if ($user->rights->propale->lire) { - $sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo, s.email,"; - $sql.= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql.= ", ".MAIN_DB_PREFIX."propal as p"; - if (!$user->rights->societe->client->voir && !$user->socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql.= " WHERE p.fk_soc = s.rowid"; - $sql.= " AND p.entity = ".$conf->entity; - if (!$user->rights->societe->client->voir && !$user->socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if($user->socid) $sql.= " AND s.rowid = ".$user->socid; - if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY p.datep DESC, p.ref DESC "; - else $sql.= " ORDER BY p.tms DESC, p.ref DESC "; - $sql.= $this->db->plimit($max, 0); + $sql = "SELECT s.nom as name, s.rowid as socid, s.code_client, s.logo, s.entity, s.email,"; + $sql .= " p.rowid, p.ref, p.fk_statut, p.datep as dp, p.datec, p.fin_validite, p.date_cloture, p.total_ht, p.tva as total_tva, p.total as total_ttc, p.tms"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql .= ", ".MAIN_DB_PREFIX."propal as p"; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql .= " WHERE p.fk_soc = s.rowid"; + $sql .= " AND p.entity = ".$conf->entity; + if (!$user->rights->societe->client->voir && !$user->socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; + if ($user->socid) $sql .= " AND s.rowid = ".$user->socid; + if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql .= " ORDER BY p.datep DESC, p.ref DESC "; + else $sql .= " ORDER BY p.tms DESC, p.ref DESC "; + $sql .= $this->db->plimit($max, 0); $result = $this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); - $now=dol_now(); + $now = dol_now(); $line = 0; while ($line < $num) { $objp = $this->db->fetch_object($result); - $date=$this->db->jdate($objp->dp); - $datec=$this->db->jdate($objp->datec); - $datem=$this->db->jdate($objp->tms); - $dateterm=$this->db->jdate($objp->fin_validite); - $dateclose=$this->db->jdate($objp->date_cloture); + $date = $this->db->jdate($objp->dp); + $datec = $this->db->jdate($objp->datec); + $datem = $this->db->jdate($objp->tms); + $dateterm = $this->db->jdate($objp->fin_validite); + $dateclose = $this->db->jdate($objp->date_cloture); $propalstatic->id = $objp->rowid; $propalstatic->ref = $objp->ref; $propalstatic->total_ht = $objp->total_ht; @@ -122,6 +123,7 @@ class box_propales extends ModeleBoxes $societestatic->code_client = $objp->code_client; $societestatic->logo = $objp->logo; $societestatic->email = $objp->email; + $societestatic->entity = $objp->entity; $late = ''; if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->propal->cloture->warning_delay)) { @@ -159,7 +161,7 @@ class box_propales extends ModeleBoxes $line++; } - if ($num==0) + if ($num == 0) $this->info_box_contents[$line][0] = array( 'td' => 'class="center"', 'text'=>$langs->trans("NoRecordedProposals"), diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index aa1aed52822..bba38bddb30 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -144,7 +144,10 @@ class CMailFile } } - $this->subject = $subject; + // Add autocopy to (Note: Adding bcc for specific modules are also done from pages) + if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO; + + $this->subject = $subject; $this->addr_to = $to; $this->addr_from = $from; $this->msg = $msg; @@ -267,9 +270,6 @@ class CMailFile } } - // Add autocopy to (Note: Adding bcc for specific modules are also done from pages) - if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO; - // We set all data according to choosed sending method. // We also set a value for ->msgid if ($this->sendmode == 'mail') diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 6fdf74f8466..80e9f4c8ab4 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -571,7 +571,7 @@ abstract class CommonObject $return = '
'; $return .= '
'; $return .= ''; - $return .= ''; // Can be image + $return .= ''; // Can be image $return .= ''; $return .= '
'; $return .= ''.(method_exists($this, 'getNomUrl') ? $this->getNomUrl() : $this->ref).''; @@ -1797,14 +1797,14 @@ abstract class CommonObject // this->ismultientitymanaged contains // 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table $aliastablesociete = 's'; - if ($this->element == 'societe') $aliastablesociete = 'te'; // te as table_element + if ($this->element == 'societe') $aliastablesociete = 'te'; // te as table_element $sql = "SELECT MAX(te.".$fieldid.")"; $sql .= " FROM ".(empty($nodbprefix) ?MAIN_DB_PREFIX:'').$this->table_element." as te"; if ($this->element == 'user' && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; } - if (isset($this->ismultientitymanaged) && ! is_numeric($this->ismultientitymanaged)) { + if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) { $tmparray = explode('@', $this->ismultientitymanaged); $sql .= ", ".MAIN_DB_PREFIX.$tmparray[1]." as ".($tmparray[1] == 'societe' ? 's' : 'parenttable'); // If we need to link to this table to limit select to entity } @@ -1819,7 +1819,7 @@ abstract class CommonObject if (!preg_match('/^\s*AND/i', $filter)) $sql .= " AND "; // For backward compatibility $sql .= $filter; } - if (isset($this->ismultientitymanaged) && ! is_numeric($this->ismultientitymanaged)) { + if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged)) { $tmparray = explode('@', $this->ismultientitymanaged); $sql .= ' AND te.'.$tmparray[0].' = '.($tmparray[1] == 'societe' ? 's' : 'parenttable').'.rowid'; // If we need to link to this table to limit select to entity } @@ -1836,7 +1836,7 @@ abstract class CommonObject $sql .= ' AND te.entity IN ('.getEntity($this->element).')'; } } - if (isset($this->ismultientitymanaged) && ! is_numeric($this->ismultientitymanaged) && $this->element != 'societe') { + if (isset($this->ismultientitymanaged) && !is_numeric($this->ismultientitymanaged) && $this->element != 'societe') { $tmparray = explode('@', $this->ismultientitymanaged); $sql .= ' AND parenttable.entity IN ('.getEntity($tmparray[1]).')'; } @@ -5625,7 +5625,7 @@ abstract class CommonObject $form = new Form($this->db); } - if (! empty($this->fields)) { + if (!empty($this->fields)) { $val = $this->fields[$key]; } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 4f5602fc5ef..87204294947 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -293,30 +293,30 @@ class Conf $rootfortemp = empty($this->global->MAIN_TEMP_DIR) ? $rootfordata : $this->global->MAIN_TEMP_DIR; // Define default dir_output and dir_temp for directories of modules - foreach($this->modules as $module) + foreach ($this->modules as $module) { //var_dump($module); // For multicompany sharings - $this->$module->multidir_output = array($this->entity => $rootfordata."/".$module); - $this->$module->multidir_temp = array($this->entity => $rootfortemp."/".$module."/temp"); + $this->$module->multidir_output = array($this->entity => $rootfordata."/".$module); + $this->$module->multidir_temp = array($this->entity => $rootfortemp."/".$module."/temp"); // For backward compatibility - $this->$module->dir_output = $rootfordata."/".$module; - $this->$module->dir_temp = $rootfortemp."/".$module."/temp"; + $this->$module->dir_output = $rootfordata."/".$module; + $this->$module->dir_temp = $rootfortemp."/".$module."/temp"; } // External modules storage - if (! empty($this->modules_parts['dir'])) + if (!empty($this->modules_parts['dir'])) { - foreach($this->modules_parts['dir'] as $module => $dirs) + foreach ($this->modules_parts['dir'] as $module => $dirs) { - if (! empty($this->$module->enabled)) + if (!empty($this->$module->enabled)) { - foreach($dirs as $type => $name) // $type is 'output' or 'temp' + foreach ($dirs as $type => $name) // $type is 'output' or 'temp' { - $multidirname = 'multidir_'.$type; - $dirname = 'dir_'.$type; + $multidirname = 'multidir_'.$type; + $dirname = 'dir_'.$type; - if($type != 'temp') + if ($type != 'temp') { // For multicompany sharings $this->$module->$multidirname = array($this->entity => $rootfordata."/".$name); @@ -338,90 +338,90 @@ class Conf } // For mycompany storage - $this->mycompany->dir_output = $rootfordata."/mycompany"; - $this->mycompany->dir_temp = $rootfortemp."/mycompany/temp"; + $this->mycompany->dir_output = $rootfordata."/mycompany"; + $this->mycompany->dir_temp = $rootfortemp."/mycompany/temp"; // For admin storage - $this->admin->dir_output = $rootfordata.'/admin'; - $this->admin->dir_temp = $rootfortemp.'/admin/temp'; + $this->admin->dir_output = $rootfordata.'/admin'; + $this->admin->dir_temp = $rootfortemp.'/admin/temp'; // For user storage - $this->user->multidir_output = array($this->entity => $rootfordata."/users"); - $this->user->multidir_temp = array($this->entity => $rootfortemp."/users/temp"); + $this->user->multidir_output = array($this->entity => $rootfordata."/users"); + $this->user->multidir_temp = array($this->entity => $rootfortemp."/users/temp"); // For backward compatibility - $this->user->dir_output = $rootforuser."/users"; - $this->user->dir_temp = $rootfortemp."/users/temp"; + $this->user->dir_output = $rootforuser."/users"; + $this->user->dir_temp = $rootfortemp."/users/temp"; // For usergroup storage - $this->usergroup->dir_output = $rootforuser."/usergroups"; - $this->usergroup->dir_temp = $rootfortemp."/usergroups/temp"; + $this->usergroup->dir_output = $rootforuser."/usergroups"; + $this->usergroup->dir_temp = $rootfortemp."/usergroups/temp"; // For proposal storage - $this->propal->multidir_output = array($this->entity => $rootfordata."/propale"); - $this->propal->multidir_temp = array($this->entity => $rootfortemp."/propale/temp"); + $this->propal->multidir_output = array($this->entity => $rootfordata."/propale"); + $this->propal->multidir_temp = array($this->entity => $rootfortemp."/propale/temp"); // For backward compatibility - $this->propal->dir_output = $rootfordata."/propale"; - $this->propal->dir_temp = $rootfortemp."/propale/temp"; + $this->propal->dir_output = $rootfordata."/propale"; + $this->propal->dir_temp = $rootfortemp."/propale/temp"; // For medias storage - $this->medias->multidir_output = array($this->entity => $rootfordata."/medias"); - $this->medias->multidir_temp = array($this->entity => $rootfortemp."/medias/temp"); + $this->medias->multidir_output = array($this->entity => $rootfordata."/medias"); + $this->medias->multidir_temp = array($this->entity => $rootfortemp."/medias/temp"); // Exception: Some dir are not the name of module. So we keep exception here for backward compatibility. // Sous module bons d'expedition - $this->expedition_bon->enabled=(! empty($this->global->MAIN_SUBMODULE_EXPEDITION)?$this->global->MAIN_SUBMODULE_EXPEDITION:0); + $this->expedition_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_EXPEDITION) ? $this->global->MAIN_SUBMODULE_EXPEDITION : 0); // Sous module bons de livraison - $this->livraison_bon->enabled=(! empty($this->global->MAIN_SUBMODULE_LIVRAISON)?$this->global->MAIN_SUBMODULE_LIVRAISON:0); + $this->livraison_bon->enabled = (!empty($this->global->MAIN_SUBMODULE_LIVRAISON) ? $this->global->MAIN_SUBMODULE_LIVRAISON : 0); // Module fournisseur - if (! empty($this->fournisseur)) + if (!empty($this->fournisseur)) { - $this->fournisseur->commande=new stdClass(); - $this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande"); - $this->fournisseur->commande->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp"); - $this->fournisseur->commande->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility - $this->fournisseur->commande->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility + $this->fournisseur->commande = new stdClass(); + $this->fournisseur->commande->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande"); + $this->fournisseur->commande->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp"); + $this->fournisseur->commande->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility + $this->fournisseur->commande->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility - $this->fournisseur->facture=new stdClass(); - $this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture"); - $this->fournisseur->facture->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp"); - $this->fournisseur->facture->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility - $this->fournisseur->facture->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility + $this->fournisseur->facture = new stdClass(); + $this->fournisseur->facture->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture"); + $this->fournisseur->facture->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp"); + $this->fournisseur->facture->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility + $this->fournisseur->facture->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility - $this->supplierproposal=new stdClass(); - $this->supplierproposal->multidir_output = array($this->entity => $rootfordata."/supplier_proposal"); - $this->supplierproposal->multidir_temp = array($this->entity => $rootfortemp."/supplier_proposal/temp"); - $this->supplierproposal->dir_output = $rootfordata."/supplier_proposal"; // For backward compatibility - $this->supplierproposal->dir_temp = $rootfortemp."/supplier_proposal/temp"; // For backward compatibility + $this->supplierproposal = new stdClass(); + $this->supplierproposal->multidir_output = array($this->entity => $rootfordata."/supplier_proposal"); + $this->supplierproposal->multidir_temp = array($this->entity => $rootfortemp."/supplier_proposal/temp"); + $this->supplierproposal->dir_output = $rootfordata."/supplier_proposal"; // For backward compatibility + $this->supplierproposal->dir_temp = $rootfortemp."/supplier_proposal/temp"; // For backward compatibility - $this->fournisseur->payment=new stdClass(); - $this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata."/fournisseur/payment"); - $this->fournisseur->payment->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/payment/temp"); - $this->fournisseur->payment->dir_output = $rootfordata."/fournisseur/payment"; // For backward compatibility - $this->fournisseur->payment->dir_temp = $rootfortemp."/fournisseur/payment/temp"; // For backward compatibility + $this->fournisseur->payment = new stdClass(); + $this->fournisseur->payment->multidir_output = array($this->entity => $rootfordata."/fournisseur/payment"); + $this->fournisseur->payment->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/payment/temp"); + $this->fournisseur->payment->dir_output = $rootfordata."/fournisseur/payment"; // For backward compatibility + $this->fournisseur->payment->dir_temp = $rootfortemp."/fournisseur/payment/temp"; // For backward compatibility // To prepare split of module fournisseur into fournisseur + supplier_order + supplier_invoice - if (! empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // By default, if module supplier is on, we set new properties + if (!empty($this->fournisseur->enabled) && empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // By default, if module supplier is on, we set new properties { if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists { - $this->supplier_order=new stdClass(); - $this->supplier_order->enabled = 1; - $this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande"); - $this->supplier_order->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp"); - $this->supplier_order->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility - $this->supplier_order->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility + $this->supplier_order = new stdClass(); + $this->supplier_order->enabled = 1; + $this->supplier_order->multidir_output = array($this->entity => $rootfordata."/fournisseur/commande"); + $this->supplier_order->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/commande/temp"); + $this->supplier_order->dir_output = $rootfordata."/fournisseur/commande"; // For backward compatibility + $this->supplier_order->dir_temp = $rootfortemp."/fournisseur/commande/temp"; // For backward compatibility } if (empty($this->global->MAIN_USE_NEW_SUPPLIERMOD)) // This can be set to 1 once modules purchase order and supplier invoice exists { - $this->supplier_invoice=new stdClass(); - $this->supplier_invoice->enabled = 1; - $this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture"); - $this->supplier_invoice->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp"); - $this->supplier_invoice->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility - $this->supplier_invoice->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility + $this->supplier_invoice = new stdClass(); + $this->supplier_invoice->enabled = 1; + $this->supplier_invoice->multidir_output = array($this->entity => $rootfordata."/fournisseur/facture"); + $this->supplier_invoice->multidir_temp = array($this->entity => $rootfortemp."/fournisseur/facture/temp"); + $this->supplier_invoice->dir_output = $rootfordata."/fournisseur/facture"; // For backward compatibility + $this->supplier_invoice->dir_temp = $rootfortemp."/fournisseur/facture/temp"; // For backward compatibility } } } @@ -438,22 +438,22 @@ class Conf $this->service->dir_temp = $rootfortemp."/produit/temp"; // Module productbatch - $this->productbatch->multidir_output = array($this->entity => $rootfordata."/produitlot"); - $this->productbatch->multidir_temp = array($this->entity => $rootfortemp."/produitlot/temp"); + $this->productbatch->multidir_output = array($this->entity => $rootfordata."/produitlot"); + $this->productbatch->multidir_temp = array($this->entity => $rootfortemp."/produitlot/temp"); // Module contrat - $this->contrat->multidir_output = array($this->entity => $rootfordata."/contract"); - $this->contrat->multidir_temp = array($this->entity => $rootfortemp."/contract/temp"); + $this->contrat->multidir_output = array($this->entity => $rootfordata."/contract"); + $this->contrat->multidir_temp = array($this->entity => $rootfortemp."/contract/temp"); // For backward compatibility - $this->contrat->dir_output = $rootfordata."/contract"; - $this->contrat->dir_temp = $rootfortemp."/contract/temp"; + $this->contrat->dir_output = $rootfordata."/contract"; + $this->contrat->dir_temp = $rootfortemp."/contract/temp"; // Module bank $this->bank->multidir_output = array($this->entity => $rootfordata."/bank"); $this->bank->multidir_temp = array($this->entity => $rootfortemp."/bank/temp"); // For backward compatibility - $this->bank->dir_output = $rootfordata."/bank"; - $this->bank->dir_temp = $rootfortemp."/bank/temp"; + $this->bank->dir_output = $rootfordata."/bank"; + $this->bank->dir_temp = $rootfortemp."/bank/temp"; // Set some default values //$this->global->MAIN_LIST_FILTER_ON_DAY=1; // On filter that show date, we must show input field for day before or after month @@ -527,7 +527,7 @@ class Conf if (empty($this->global->MAIN_THEME)) $this->global->MAIN_THEME = "eldy"; if (!empty($this->global->MAIN_FORCETHEME)) $this->global->MAIN_THEME = $this->global->MAIN_FORCETHEME; $this->theme = $this->global->MAIN_THEME; - $this->css = "/theme/".$this->theme."/style.css.php"; + $this->css = "/theme/".$this->theme."/style.css.php"; // conf->email_from = email pour envoi par dolibarr des mails automatiques $this->email_from = "robot@example.com"; @@ -681,8 +681,6 @@ class Conf $this->global->AGENDA_DEFAULT_FILTER_TYPE = '0'; // 'AC_NON_AUTO' does not exists when AGENDA_DEFAULT_FILTER_TYPE is not on. } - if (!isset($this->global->MAIN_EXTRAFIELDS_IN_ONE_TD)) $this->global->MAIN_EXTRAFIELDS_IN_ONE_TD = 1; - if (!isset($this->global->MAIN_USE_OLD_TITLE_BUTTON)) $this->global->MAIN_USE_OLD_TITLE_BUTTON = 0; if (empty($this->global->MAIN_MODULE_DOLISTORE_API_SRV)) $this->global->MAIN_MODULE_DOLISTORE_API_SRV = 'https://www.dolistore.com'; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 06b6ec2d949..a38c25f7614 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -90,7 +90,7 @@ class DolEditor { $content = dol_htmlentitiesbr($content); // If content is not HTML, we convert to HTML. } - if ($this->tool == 'fckeditor') + /*if ($this->tool == 'fckeditor') { require_once DOL_DOCUMENT_ROOT.'/includes/fckeditor/fckeditor.php'; @@ -121,7 +121,7 @@ class DolEditor $this->editor->Config['CustomConfigurationsPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/fckconfig.js'; $this->editor->Config['SkinPath'] = DOL_URL_ROOT.'/theme/'.$conf->theme.'/fckeditor/'; } - } + }*/ // Define some properties if (in_array($this->tool, array('textarea', 'ckeditor', 'ace'))) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index ba8fcabe3f1..e1e7d97f821 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2431,6 +2431,7 @@ class Form $outlabel = $objp->label; $outdesc = $objp->description; $outbarcode = $objp->barcode; + $outpbq = empty($objp->price_by_qty_rowid) ? '' : $objp->price_by_qty_rowid; $outtype = $objp->fk_product_type; $outdurationvalue = $outtype == Product::TYPE_SERVICE ?substr($objp->duration, 0, dol_strlen($objp->duration) - 1) : ''; @@ -2478,7 +2479,7 @@ class Form $opt .= ($objp->rowid == $selected) ? ' selected' : ''; if (!empty($objp->price_by_qty_rowid) && $objp->price_by_qty_rowid > 0) { - $opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; + $opt .= ' pbq="'.$objp->price_by_qty_rowid.'" data-pbq="'.$objp->price_by_qty_rowid.'" data-pbqup="'.$objp->price_by_qty_unitprice.'" data-pbqbase="'.$objp->price_by_qty_price_base_type.'" data-pbqqty="'.$objp->price_by_qty_quantity.'" data-pbqpercent="'.$objp->price_by_qty_remise_percent.'"'; } if (!empty($conf->stock->enabled) && isset($objp->stock) && ($objp->fk_product_type == Product::TYPE_PRODUCT || !empty($conf->global->STOCK_SUPPORTS_SERVICES))) { @@ -2664,7 +2665,7 @@ class Form } $opt .= "\n"; - $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit); + $optJson = array('key'=>$outkey, 'value'=>$outref, 'label'=>$outval, 'label2'=>$outlabel, 'desc'=>$outdesc, 'type'=>$outtype, 'price_ht'=>price2num($outprice_ht), 'price_ttc'=>price2num($outprice_ttc), 'pricebasetype'=>$outpricebasetype, 'tva_tx'=>$outtva_tx, 'qty'=>$outqty, 'discount'=>$outdiscount, 'duration_value'=>$outdurationvalue, 'duration_unit'=>$outdurationunit, 'pbq'=>$outpbq); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 7012b813f7d..21c15b3b7c6 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -50,7 +50,7 @@ class FormAdmin * @param string $selected Language pre-selected * @param string $htmlname Name of HTML select * @param int $showauto Show 'auto' choice - * @param array $filter Array of keys to exclude in list + * @param array $filter Array of keys to exclude in list (opposite of $onlykeys) * @param string $showempty '1'=Add empty value or string to show * @param int $showwarning Show a warning if language is not complete * @param int $disabled Disable edit of select @@ -58,16 +58,18 @@ class FormAdmin * @param int $showcode 1=Add language code into label at begining, 2=Add language code into label at end * @param int $forcecombo Force to use combo box (so no ajax beautify effect) * @param int $multiselect Make the combo a multiselect + * @param array $onlykeys Show only the following keys (opposite of $filter) + * @param int $mainlangonly 1=Show only main languages ('fr_FR' no' fr_BE', 'es_ES' not 'es_MX', ...) * @return string Return HTML select string with list of languages */ - public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0, $multiselect = 0) + public function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0, $multiselect = 0, $onlykeys = array(), $mainlangonly = 0) { // phpcs:enable global $conf, $langs; if (!empty($conf->global->MAIN_DEFAULT_LANGUAGE_FILTER)) $filter[$conf->global->MAIN_DEFAULT_LANGUAGE_FILTER] = 1; - $langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT, 12); + $langs_available=$langs->get_available_languages(DOL_DOCUMENT_ROOT, 12, 0, $mainlangonly); $out=''; @@ -94,19 +96,28 @@ class FormAdmin { $valuetoshow=$value; if ($showcode == 1) $valuetoshow=$key.' - '.$value; - if ($showcode == 2) $valuetoshow=$value.' ('.$key.')'; + if ($showcode == 2) { + if ($mainlangonly) $valuetoshow=$value.' ('.preg_replace('/[_-].*$/', '', $key).')'; + else $valuetoshow=$value.' ('.$key.')'; + } - if ($filter && is_array($filter) && array_key_exists($key, $filter)) - { + $keytouse = $key; + if ($mainlangonly) $keytouse = preg_replace('/[_-].*$/', '', $key); + + if ($filter && is_array($filter) && array_key_exists($keytouse, $filter)) { continue; } - elseif ($selected == $key) + if ($onlykeys && is_array($onlykeys) && ! array_key_exists($keytouse, $onlykeys)) { + continue; + } + + if ($selected == $keytouse) { - $out.= ''; + $out.= ''; } else { - $out.= ''; + $out.= ''; } } $out.= ''; @@ -134,49 +145,49 @@ class FormAdmin public function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib = '') { // phpcs:enable - global $langs,$conf; + global $langs, $conf; // Clean parameters // Check parameters - if (! is_array($dirmenuarray)) return -1; + if (!is_array($dirmenuarray)) return -1; - $menuarray=array(); + $menuarray = array(); foreach ($conf->file->dol_document_root as $dirroot) { - foreach($dirmenuarray as $dirtoscan) + foreach ($dirmenuarray as $dirtoscan) { - $dir=$dirroot.$dirtoscan; + $dir = $dirroot.$dirtoscan; //print $dir.'
'; if (is_dir($dir)) { - $handle=opendir($dir); + $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) + while (($file = readdir($handle)) !== false) { if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && substr($file, 0, 5) != 'index') { - if (preg_match('/lib\.php$/i', $file)) continue; // We exclude library files - if (preg_match('/eldy_(backoffice|frontoffice)\.php$/i', $file)) continue; // We exclude all menu manager files - if (preg_match('/auguria_(backoffice|frontoffice)\.php$/i', $file)) continue; // We exclude all menu manager files - if (preg_match('/smartphone_(backoffice|frontoffice)\.php$/i', $file)) continue; // We exclude all menu manager files + if (preg_match('/lib\.php$/i', $file)) continue; // We exclude library files + if (preg_match('/eldy_(backoffice|frontoffice)\.php$/i', $file)) continue; // We exclude all menu manager files + if (preg_match('/auguria_(backoffice|frontoffice)\.php$/i', $file)) continue; // We exclude all menu manager files + if (preg_match('/smartphone_(backoffice|frontoffice)\.php$/i', $file)) continue; // We exclude all menu manager files - $filelib=preg_replace('/\.php$/i', '', $file); - $prefix=''; + $filelib = preg_replace('/\.php$/i', '', $file); + $prefix = ''; // 0=Recommanded, 1=Experimental, 2=Developpement, 3=Other - if (preg_match('/^eldy/i', $file)) $prefix='0'; - elseif (preg_match('/^smartphone/i', $file)) $prefix='2'; - else $prefix='3'; + if (preg_match('/^eldy/i', $file)) $prefix = '0'; + elseif (preg_match('/^smartphone/i', $file)) $prefix = '2'; + else $prefix = '3'; if ($file == $selected) { - $menuarray[$prefix.'_'.$file]=''; + $menuarray[$prefix.'_'.$file] = ''; } else { - $menuarray[$prefix.'_'.$file]=''; + $menuarray[$prefix.'_'.$file] = ''; } } } @@ -188,26 +199,26 @@ class FormAdmin ksort($menuarray); // Output combo list of menus - print ''; + $oldprefix = ''; foreach ($menuarray as $key => $val) { - $tab=explode('_', $key); - $newprefix=$tab[0]; - if ($newprefix=='1' && ($conf->global->MAIN_FEATURES_LEVEL < 1)) continue; - if ($newprefix=='2' && ($conf->global->MAIN_FEATURES_LEVEL < 2)) continue; + $tab = explode('_', $key); + $newprefix = $tab[0]; + if ($newprefix == '1' && ($conf->global->MAIN_FEATURES_LEVEL < 1)) continue; + if ($newprefix == '2' && ($conf->global->MAIN_FEATURES_LEVEL < 2)) continue; if ($newprefix != $oldprefix) // Add separators { // Affiche titre print ''; - $oldprefix=$newprefix; + $oldprefix = $newprefix; } - print $val."\n"; // Show menu entry + print $val."\n"; // Show menu entry } print ''; } @@ -224,37 +235,37 @@ class FormAdmin public function select_menu_families($selected, $htmlname, $dirmenuarray) { // phpcs:enable - global $langs,$conf; + global $langs, $conf; //$expdevmenu=array('smartphone_backoffice.php','smartphone_frontoffice.php'); // Menu to disable if $conf->global->MAIN_FEATURES_LEVEL is not set - $expdevmenu=array(); + $expdevmenu = array(); - $menuarray=array(); + $menuarray = array(); - foreach($dirmenuarray as $dirmenu) + foreach ($dirmenuarray as $dirmenu) { foreach ($conf->file->dol_document_root as $dirroot) { - $dir=$dirroot.$dirmenu; + $dir = $dirroot.$dirmenu; if (is_dir($dir)) { - $handle=opendir($dir); + $handle = opendir($dir); if (is_resource($handle)) { - while (($file = readdir($handle))!==false) + while (($file = readdir($handle)) !== false) { if (is_file($dir."/".$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS') { - $filelib=preg_replace('/(_backoffice|_frontoffice)?\.php$/i', '', $file); + $filelib = preg_replace('/(_backoffice|_frontoffice)?\.php$/i', '', $file); if (preg_match('/^index/i', $filelib)) continue; if (preg_match('/^default/i', $filelib)) continue; if (preg_match('/^empty/i', $filelib)) continue; if (preg_match('/\.lib/i', $filelib)) continue; if (empty($conf->global->MAIN_FEATURES_LEVEL) && in_array($file, $expdevmenu)) continue; - $menuarray[$filelib]=1; + $menuarray[$filelib] = 1; } - $menuarray['all']=1; + $menuarray['all'] = 1; } closedir($handle); } @@ -266,11 +277,11 @@ class FormAdmin // Affichage liste deroulante des menus print ''; + $out .= ''; + $out .= ''; return $out; } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index b7e9c53a845..238c3cad60a 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -112,14 +112,7 @@ class FormMail extends Form public $withfrom; /** - * @var int - * @deprecated Fill withto with array before calling method. - * @see $withto - */ - public $withtosocid; - - /** - * @var int|int[] + * @var int|string|array */ public $withto; // Show recipient emails diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index fc30f0798b3..d16ec9efc94 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -53,6 +53,11 @@ class FormSms public $withtopic; public $withbody; + /** + * @var int Id of company + */ + public $withtosocid; + public $withfromreadonly; public $withreplytoreadonly; public $withtoreadonly; diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index 6cd88175a67..7b067fa11d6 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -269,7 +269,15 @@ class FormWebsite $valueforoption = '['.$valpage->type_container.' '.sprintf("%03d", $valpage->id).'] '; $valueforoption .= $valpage->pageurl.' - '.$valpage->title; - if ($website->fk_default_home && $key == $website->fk_default_home) $valueforoption .= ' ('.$langs->trans("HomePage").')'; + if ($website->otherlang) { // If there is alternative lang for this web site, we show the language code + if ($valpage->lang) { + $valueforoption .= ' ('.$valpage->lang.')'; + } + } + if ($website->fk_default_home && $key == $website->fk_default_home) { + //$valueforoption .= ' ('.$langs->trans("HomePage").')'; + $valueforoption .= ' '; + } $out .= '
'; + print ''; + } // Customer invoices if (!empty($conf->facture->enabled) && $user->rights->facture->lire) { @@ -518,7 +536,7 @@ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_sho if (empty($measuring_unit_cache[$unit.'_'.$measuring_style.'_'.$scale.'_'.$use_short_label])) { require_once DOL_DOCUMENT_ROOT.'/core/class/cunits.class.php'; - $measuringUnits= new CUnits($db); + $measuringUnits = new CUnits($db); if ($measuring_style == '' && $scale == '') { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 7609d7b759b..ddca8ef1153 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -265,7 +265,7 @@ function project_timesheet_prepare_head($mode, $fuser = null) if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERMONTH)) { - $head[$h][0] = DOL_URL_ROOT."/projet/activity/permonth.php".($param?'?'.$param:''); + $head[$h][0] = DOL_URL_ROOT."/projet/activity/permonth.php".($param ? '?'.$param : ''); $head[$h][1] = $langs->trans("InputPerMonth"); $head[$h][2] = 'inputpermonth'; $h++; @@ -1735,19 +1735,19 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & global $conf, $db, $user, $bc, $langs; global $form, $formother, $projectstatic, $taskstatic, $thirdpartystatic; - $numlines=count($lines); + $numlines = count($lines); - $lastprojectid=0; - $workloadforid=array(); - $totalforeachweek=array(); - $lineswithoutlevel0=array(); + $lastprojectid = 0; + $workloadforid = array(); + $totalforeachweek = array(); + $lineswithoutlevel0 = array(); // Create a smaller array with sublevels only to be used later. This increase dramatically performances. if ($parent == 0) // Always and only if at first level { - for ($i = 0 ; $i < $numlines ; $i++) + for ($i = 0; $i < $numlines; $i++) { - if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[]=$lines[$i]; + if ($lines[$i]->fk_task_parent) $lineswithoutlevel0[] = $lines[$i]; } } @@ -1755,24 +1755,24 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & if (empty($oldprojectforbreak)) { - $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT)?0:-1); // 0 = start break, -1 = never break + $oldprojectforbreak = (empty($conf->global->PROJECT_TIMESHEET_DISABLEBREAK_ON_PROJECT) ? 0 : -1); // 0 = start break, -1 = never break } - for ($i = 0 ; $i < $numlines ; $i++) + for ($i = 0; $i < $numlines; $i++) { if ($parent == 0) $level = 0; if ($lines[$i]->fk_task_parent == $parent) { // If we want all or we have a role on task, we show it - if (empty($mine) || ! empty($tasksrole[$lines[$i]->id])) + if (empty($mine) || !empty($tasksrole[$lines[$i]->id])) { //dol_syslog("projectLinesPerWeek Found line ".$i.", a qualified task (i have role or want to show all tasks) with id=".$lines[$i]->id." project id=".$lines[$i]->fk_project); // Break on a new project if ($parent == 0 && $lines[$i]->fk_project != $lastprojectid) { - $lastprojectid=$lines[$i]->fk_project; + $lastprojectid = $lines[$i]->fk_project; $projectstatic->id = $lines[$i]->fk_project; } @@ -1780,32 +1780,32 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & //var_dump($projectstatic->weekWorkLoadPerTask); if (empty($workloadforid[$projectstatic->id])) { - $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week - $workloadforid[$projectstatic->id]=1; + $projectstatic->loadTimeSpentMonth($firstdaytoshow, 0, $fuser->id); // Load time spent from table projet_task_time for the project into this->weekWorkLoad and this->weekWorkLoadPerTask for all days of a week + $workloadforid[$projectstatic->id] = 1; } //var_dump($projectstatic->weekWorkLoadPerTask); //var_dump('--- '.$projectstatic->id.' '.$workloadforid[$projectstatic->id]); - $projectstatic->id=$lines[$i]->fk_project; - $projectstatic->ref=$lines[$i]->projectref; - $projectstatic->title=$lines[$i]->projectlabel; - $projectstatic->public=$lines[$i]->public; - $projectstatic->thirdparty_name=$lines[$i]->thirdparty_name; + $projectstatic->id = $lines[$i]->fk_project; + $projectstatic->ref = $lines[$i]->projectref; + $projectstatic->title = $lines[$i]->projectlabel; + $projectstatic->public = $lines[$i]->public; + $projectstatic->thirdparty_name = $lines[$i]->thirdparty_name; - $taskstatic->id=$lines[$i]->id; - $taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id); - $taskstatic->label=$lines[$i]->label; - $taskstatic->date_start=$lines[$i]->date_start; - $taskstatic->date_end=$lines[$i]->date_end; + $taskstatic->id = $lines[$i]->id; + $taskstatic->ref = ($lines[$i]->ref ? $lines[$i]->ref : $lines[$i]->id); + $taskstatic->label = $lines[$i]->label; + $taskstatic->date_start = $lines[$i]->date_start; + $taskstatic->date_end = $lines[$i]->date_end; - $thirdpartystatic->id=$lines[$i]->thirdparty_id; - $thirdpartystatic->name=$lines[$i]->thirdparty_name; - $thirdpartystatic->email=$lines[$i]->thirdparty_email; + $thirdpartystatic->id = $lines[$i]->thirdparty_id; + $thirdpartystatic->name = $lines[$i]->thirdparty_name; + $thirdpartystatic->email = $lines[$i]->thirdparty_email; if (empty($oldprojectforbreak) || ($oldprojectforbreak != -1 && $oldprojectforbreak != $projectstatic->id)) { print ''."\n"; - print ''; // Time spent by everybody @@ -1877,66 +1877,66 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & // Time spent by user print '\n"; - $disabledproject=1;$disabledtask=1; + $disabledproject = 1; $disabledtask = 1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); //var_dump($projectsrole[$lines[$i]->fk_project]); // If at least one role for project - if ($lines[$i]->public || ! empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) + if ($lines[$i]->public || !empty($projectsrole[$lines[$i]->fk_project]) || $user->rights->projet->all->creer) { - $disabledproject=0; - $disabledtask=0; + $disabledproject = 0; + $disabledtask = 0; } // If $restricteditformytask is on and I have no role on task, i disable edit if ($restricteditformytask && empty($tasksrole[$lines[$i]->id])) { - $disabledtask=1; + $disabledtask = 1; } //var_dump($projectstatic->weekWorkLoadPerTask); //TODO // Fields to show current time - $tableCell=''; $modeinput='hours'; + $tableCell = ''; $modeinput = 'hours'; $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow)); $TFirstDay[reset($TWeek)] = 1; - foreach($TFirstDay as &$fday) { + foreach ($TFirstDay as &$fday) { $fday--; } foreach ($TWeek as $weekNb) { $weekWorkLoad = $projectstatic->monthWorkLoadPerTask[$weekNb][$lines[$i]->id]; - $totalforeachweek[$weekNb]+=$weekWorkLoad; + $totalforeachweek[$weekNb] += $weekWorkLoad; - $alreadyspent=''; - if ($weekWorkLoad > 0) $alreadyspent=convertSecondToTime($weekWorkLoad, 'allhourmin'); - $alttitle=$langs->trans("AddHereTimeSpentForWeek", $weekNb); + $alreadyspent = ''; + if ($weekWorkLoad > 0) $alreadyspent = convertSecondToTime($weekWorkLoad, 'allhourmin'); + $alttitle = $langs->trans("AddHereTimeSpentForWeek", $weekNb); - $tableCell =''; + $tableCell .= ''; + $tableCell .= ''; print $tableCell; } // Warning print '\n"; $total_plannedworkload = 0; @@ -2179,8 +2180,8 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $projectstatic->datee = $db->jdate($objp->datee); $projectstatic->dateo = $db->jdate($objp->dateo); - print ''; + print ''; + if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (!in_array('prospectionstatus', $hiddenfields)) { + print ''; + } + print ''; @@ -2207,6 +2235,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } print ''; } + if (empty($conf->global->PROJECT_HIDE_TASKS)) { print ''; @@ -2228,23 +2257,12 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks } } - print ''; } - if ($oppStatusCode) { - if (!empty($oppStatusColor)) { - print ''; - } else { - print '' . $oppStatusCode . ''; - } - } - print ''; + print "\n"; $total_task = $total_task + $objp->nb; @@ -2258,6 +2276,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print '"; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (!in_array('prospectionstatus', $hiddenfields)) { + print ''; + } print ''; print ''; } @@ -2267,7 +2288,9 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks if (!in_array('plannedworkload', $hiddenfields)) print ''; if (!in_array('declaredprogress', $hiddenfields)) print ''; } - print ''; + if (!in_array('projectstatus', $hiddenfields)) { + print ''; + } print ''; $db->free($resql); diff --git a/htdocs/core/lib/takepos.lib.php b/htdocs/core/lib/takepos.lib.php index dc86853859e..65ad4c091a0 100644 --- a/htdocs/core/lib/takepos.lib.php +++ b/htdocs/core/lib/takepos.lib.php @@ -38,13 +38,10 @@ function takepos_prepare_head() $head[$h][2] = 'setup'; $h++; - if ($conf->global->TAKEPOS_CUSTOM_RECEIPT) - { - $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/receipt.php'; - $head[$h][1] = $langs->trans("Receipt"); - $head[$h][2] = 'receipt'; - $h++; - } + $head[$h][0] = DOL_URL_ROOT.'/takepos/admin/receipt.php'; + $head[$h][1] = $langs->trans("Receipt"); + $head[$h][2] = 'receipt'; + $h++; $numterminals = max(1, $conf->global->TAKEPOS_NUM_TERMINALS); for ($i = 1; $i <= $numterminals; $i++) diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index f97c6efed1c..05e70f7912d 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -239,15 +239,15 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') { global $website; + $content = str_replace('id.'.tpl.php\'; '; + $aliascontent .= 'else require $dolibarr_main_data_root.\'/website/\'.$website->ref.\'/page'.$objectpage->id.'.tpl.php\';'."\n"; + $aliascontent .= '?>'."\n"; + $result = file_put_contents($filealias, $aliascontent); + if (!empty($conf->global->MAIN_UMASK)) { + @chmod($filealias, octdec($conf->global->MAIN_UMASK)); + } + } + return ($result ?true:false); } @@ -85,6 +104,7 @@ function dolSavePageAlias($filealias, $object, $objectpage) * @param Website $object Object website * @param WebsitePage $objectpage Object websitepage * @return boolean True if OK + * @see dolSavePageAlias() */ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) { @@ -101,7 +121,10 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tplcontent = ''; $tplcontent .= "isMultiLang()) { // Add myself - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; // Add page "translation of" $translationof = $objectpage->fk_page; if ($translationof) { @@ -135,7 +158,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tmpshortlangcode = ''; if ($tmppage->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $tmppage->lang); // en_US or en-US -> en if ($tmpshortlangcode != $shortlangcode) { - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; } } } @@ -152,7 +175,7 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) $tmpshortlangcode = ''; if ($obj->lang) $tmpshortlangcode = preg_replace('/[_-].*$/', '', $obj->lang); // en_US or en-US -> en if ($tmpshortlangcode != $shortlangcode) { - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; } } } @@ -160,11 +183,11 @@ function dolSavePageContent($filetpl, Website $object, WebsitePage $objectpage) else dol_print_error($db); } // Add canonical reference - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; // Add manifest.json on homepage $tplcontent .= 'use_manifest) { print \'\'."\n"; } ?>'."\n"; $tplcontent .= ''."\n"; - $tplcontent .= ''."\n"; + $tplcontent .= ''."\n"; $tplcontent .= ''."\n"; $tplcontent .= '/ims\', \'\', file_get_contents(DOL_DATA_ROOT."/website/".$websitekey."/htmlheader.html")); ?>'."\n"; $tplcontent .= ''."\n"; diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 109de3a99c4..f66768b7ffb 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -1683,11 +1683,11 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 1) { $newmenu->add("/projet/list.php?leftmenu=projets".($search_project_user ? '&search_project_user='.$search_project_user : ''), $langs->trans("List"), 1, $showmode, '', 'project', 'list'); - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=openedopp&search_status=99&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99&contextpage=lead', $langs->trans("ListOpenLeads"), 2, $showmode); $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=notopenedopp&search_status=99&contextpage=project', $langs->trans("ListOpenProjects"), 2, $showmode); } elseif ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only - $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_opp_status=openedopp&search_status=99', $langs->trans("List"), 2, $showmode); + $newmenu->add('/projet/list.php?mainmenu=project&leftmenu=list&search_usage_opportunity=1&search_status=99', $langs->trans("List"), 2, $showmode); } $newmenu->add("/projet/stats/index.php?leftmenu=projects", $langs->trans("Statistics"), 1, $user->rights->projet->lire); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 6e3d887cbce..b8740fa60de 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -1315,27 +1315,27 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index f4fc2b3cb2f..5bdc591c2fb 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -621,7 +621,7 @@ class pdf_eratosthene extends ModelePDFCommandes { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -1475,27 +1475,27 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index 4594a9d63cd..190abd86126 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -185,7 +185,7 @@ class doc_generic_contract_odt extends ModelePDFContract /** * Function to build a document on disk using the generic odt module. * - * @param Contract $object Object source to build document + * @param Contrat $object Object source to build document * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 01ebd673041..4c025750f04 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -42,7 +42,7 @@ class html_cerfafr extends ModeleDon */ public function __construct($db) { - global $conf,$langs; + global $conf, $langs; $this->db = $db; $this->name = "cerfafr"; @@ -76,46 +76,46 @@ class html_cerfafr extends ModeleDon public function write_file($don, $outputlangs, $currency = '') { // phpcs:enable - global $user,$conf,$langs,$mysoc; + global $user, $conf, $langs, $mysoc; - $now=dol_now(); - $id = (! is_object($don)?$don:''); + $now = dol_now(); + $id = (!is_object($don) ? $don : ''); - if (! is_object($outputlangs)) $outputlangs=$langs; + if (!is_object($outputlangs)) $outputlangs = $langs; // Load traductions files required by page $outputlangs->loadLangs(array("main", "dict", "companies", "bills", "products", "donations")); $currency = !empty($currency) ? $currency : $conf->currency; - if (! empty($conf->don->dir_output)) + if (!empty($conf->don->dir_output)) { // Definition of the object don (for upward compatibility) - if (! is_object($don)) + if (!is_object($don)) { $don = new Don($this->db); - $ret=$don->fetch($id); - $id=$don->id; + $ret = $don->fetch($id); + $id = $don->id; } // Definition of $dir and $file - if (! empty($don->specimen)) + if (!empty($don->specimen)) { $dir = $conf->don->dir_output; - $file = $dir . "/SPECIMEN.html"; + $file = $dir."/SPECIMEN.html"; } else { $donref = dol_sanitizeFileName($don->ref); - $dir = $conf->don->dir_output . "/" . $donref; - $file = $dir . "/" . $donref . ".html"; + $dir = $conf->don->dir_output."/".$donref; + $file = $dir."/".$donref.".html"; } - if (! file_exists($dir)) + if (!file_exists($dir)) { if (dol_mkdir($dir) < 0) { - $this->error=$langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return -1; } } @@ -133,13 +133,13 @@ class html_cerfafr extends ModeleDon } else $paymentmode = ''; - if ($don->modepaymentcode=='CHQ'){ + if ($don->modepaymentcode == 'CHQ') { $ModePaiement = ''; } - elseif ($don->modepaymentcode=='LIQ'){ + elseif ($don->modepaymentcode == 'LIQ') { $ModePaiement = ''; } - elseif ($don->modepaymentcode=='VIR' || $don->modepaymentcode=='PRE' || $don->modepaymentcode=='CB'){ + elseif ($don->modepaymentcode == 'VIR' || $don->modepaymentcode == 'PRE' || $don->modepaymentcode == 'CB') { $ModePaiement = ''; } else @@ -159,7 +159,7 @@ class html_cerfafr extends ModeleDon */ // Define contents - $donmodel=DOL_DOCUMENT_ROOT ."/core/modules/dons/html_cerfafr.html"; + $donmodel = DOL_DOCUMENT_ROOT."/core/modules/dons/html_cerfafr.html"; $form = implode('', file($donmodel)); $form = str_replace('__REF__', $don->id, $form); $form = str_replace('__DATE__', dol_print_date($don->date, 'day', false, $outputlangs), $form); @@ -203,59 +203,59 @@ class html_cerfafr extends ModeleDon $form = str_replace('__ModePaiement__', $ModePaiement, $form); - $frencharticle=''; - if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencharticle='Article 200, 238 bis et 978 du code général des impôts (CGI)'; + $frencharticle = ''; + if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencharticle = 'Article 200, 238 bis et 978 du code général des impôts (CGI)'; $form = str_replace('__FrenchArticle__', $frencharticle, $form); - $frencheligibility=''; - if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencheligibility='Le bénéficiaire certifie sur l\'honneur que les dons et versements qu\'il reçoit ouvrent droit à la réduction d\'impôt prévue à l\'article :'; + $frencheligibility = ''; + if (preg_match('/fr/i', $outputlangs->defaultlang)) $frencheligibility = 'Le bénéficiaire certifie sur l\'honneur que les dons et versements qu\'il reçoit ouvrent droit à la réduction d\'impôt prévue à l\'article :'; $form = str_replace('__FrenchEligibility__', $frencheligibility, $form); - $art200=''; + $art200 = ''; if (preg_match('/fr/i', $outputlangs->defaultlang)) { if ($conf->global->DONATION_ART200 >= 1) { - $art200='200 du CGI'; + $art200 = '200 du CGI'; } else { - $art200='200 du CGI'; + $art200 = '200 du CGI'; } } $form = str_replace('__ARTICLE200__', $art200, $form); - $art238=''; + $art238 = ''; if (preg_match('/fr/i', $outputlangs->defaultlang)) { if ($conf->global->DONATION_ART238 >= 1) { - $art238='238 bis du CGI'; + $art238 = '238 bis du CGI'; } else { - $art238='238 bis du CGI'; + $art238 = '238 bis du CGI'; } } $form = str_replace('__ARTICLE238__', $art238, $form); - $art978=''; + $art978 = ''; if (preg_match('/fr/i', $outputlangs->defaultlang)) { if ($conf->global->DONATION_ART978 >= 1) { - $art978='978 du CGI'; + $art978 = '978 du CGI'; } else { - $art978='978 du CGI'; + $art978 = '978 du CGI'; } } $form = str_replace('__ARTICLE978__', $art978, $form); // Save file on disk dol_syslog("html_cerfafr::write_file $file"); - $handle=fopen($file, "w"); + $handle = fopen($file, "w"); fwrite($handle, $form); fclose($handle); - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($file, octdec($conf->global->MAIN_UMASK)); $this->result = array('fullpath'=>$file); @@ -264,13 +264,13 @@ class html_cerfafr extends ModeleDon } else { - $this->error=$langs->trans("ErrorCanNotCreateDir", $dir); + $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } else { - $this->error=$langs->trans("ErrorConstantNotDefined", "DON_OUTPUTDIR"); + $this->error = $langs->trans("ErrorConstantNotDefined", "DON_OUTPUTDIR"); return 0; } } @@ -288,147 +288,147 @@ class html_cerfafr extends ModeleDon $unite = array(); $dix = array(); $cent = array(); - if(empty($devise1)) $dev1='euros'; - else $dev1=$devise1; - if(empty($devise2)) $dev2='centimes'; - else $dev2=$devise2; - $valeur_entiere=intval($montant); - $valeur_decimal=intval(round($montant-intval($montant), 2)*100); - $dix_c=intval($valeur_decimal%100/10); - $cent_c=intval($valeur_decimal%1000/100); - $unite[1]=$valeur_entiere%10; - $dix[1]=intval($valeur_entiere%100/10); - $cent[1]=intval($valeur_entiere%1000/100); - $unite[2]=intval($valeur_entiere%10000/1000); - $dix[2]=intval($valeur_entiere%100000/10000); - $cent[2]=intval($valeur_entiere%1000000/100000); - $unite[3]=intval($valeur_entiere%10000000/1000000); - $dix[3]=intval($valeur_entiere%100000000/10000000); - $cent[3]=intval($valeur_entiere%1000000000/100000000); - $chif=array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf'); - $secon_c=''; - $trio_c=''; - for($i=1; $i<=3; $i++) { - $prim[$i]=''; - $secon[$i]=''; - $trio[$i]=''; - if ($dix[$i]==0) { - $secon[$i]=''; - $prim[$i]=$chif[$unite[$i]]; + if (empty($devise1)) $dev1 = 'euros'; + else $dev1 = $devise1; + if (empty($devise2)) $dev2 = 'centimes'; + else $dev2 = $devise2; + $valeur_entiere = intval($montant); + $valeur_decimal = intval(round($montant - intval($montant), 2) * 100); + $dix_c = intval($valeur_decimal % 100 / 10); + $cent_c = intval($valeur_decimal % 1000 / 100); + $unite[1] = $valeur_entiere % 10; + $dix[1] = intval($valeur_entiere % 100 / 10); + $cent[1] = intval($valeur_entiere % 1000 / 100); + $unite[2] = intval($valeur_entiere % 10000 / 1000); + $dix[2] = intval($valeur_entiere % 100000 / 10000); + $cent[2] = intval($valeur_entiere % 1000000 / 100000); + $unite[3] = intval($valeur_entiere % 10000000 / 1000000); + $dix[3] = intval($valeur_entiere % 100000000 / 10000000); + $cent[3] = intval($valeur_entiere % 1000000000 / 100000000); + $chif = array('', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit', 'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize', 'dix sept', 'dix huit', 'dix neuf'); + $secon_c = ''; + $trio_c = ''; + for ($i = 1; $i <= 3; $i++) { + $prim[$i] = ''; + $secon[$i] = ''; + $trio[$i] = ''; + if ($dix[$i] == 0) { + $secon[$i] = ''; + $prim[$i] = $chif[$unite[$i]]; } - elseif ($dix[$i]==1) { - $secon[$i]=''; - $prim[$i]=$chif[($unite[$i]+10)]; + elseif ($dix[$i] == 1) { + $secon[$i] = ''; + $prim[$i] = $chif[($unite[$i] + 10)]; } - elseif ($dix[$i]==2) { - if ($unite[$i]==1) { - $secon[$i]='vingt et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 2) { + if ($unite[$i] == 1) { + $secon[$i] = 'vingt et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='vingt'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'vingt'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==3) { - if ($unite[$i]==1) { - $secon[$i]='trente et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 3) { + if ($unite[$i] == 1) { + $secon[$i] = 'trente et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='trente'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'trente'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==4) { - if ($unite[$i]==1) { - $secon[$i]='quarante et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 4) { + if ($unite[$i] == 1) { + $secon[$i] = 'quarante et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='quarante'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'quarante'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==5) { - if ($unite[$i]==1) { - $secon[$i]='cinquante et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 5) { + if ($unite[$i] == 1) { + $secon[$i] = 'cinquante et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='cinquante'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'cinquante'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==6) { - if ($unite[$i]==1) { - $secon[$i]='soixante et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 6) { + if ($unite[$i] == 1) { + $secon[$i] = 'soixante et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='soixante'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'soixante'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==7) { - if ($unite[$i]==1) { - $secon[$i]='soixante et'; - $prim[$i]=$chif[$unite[$i]+10]; + elseif ($dix[$i] == 7) { + if ($unite[$i] == 1) { + $secon[$i] = 'soixante et'; + $prim[$i] = $chif[$unite[$i] + 10]; } else { - $secon[$i]='soixante'; - $prim[$i]=$chif[$unite[$i]+10]; + $secon[$i] = 'soixante'; + $prim[$i] = $chif[$unite[$i] + 10]; } } - elseif ($dix[$i]==8) { - if ($unite[$i]==1) { - $secon[$i]='quatre-vingts et'; - $prim[$i]=$chif[$unite[$i]]; + elseif ($dix[$i] == 8) { + if ($unite[$i] == 1) { + $secon[$i] = 'quatre-vingts et'; + $prim[$i] = $chif[$unite[$i]]; } else { - $secon[$i]='quatre-vingt'; - $prim[$i]=$chif[$unite[$i]]; + $secon[$i] = 'quatre-vingt'; + $prim[$i] = $chif[$unite[$i]]; } } - elseif ($dix[$i]==9) { - if ($unite[$i]==1) { - $secon[$i]='quatre-vingts et'; - $prim[$i]=$chif[$unite[$i]+10]; + elseif ($dix[$i] == 9) { + if ($unite[$i] == 1) { + $secon[$i] = 'quatre-vingts et'; + $prim[$i] = $chif[$unite[$i] + 10]; } else { - $secon[$i]='quatre-vingts'; - $prim[$i]=$chif[$unite[$i]+10]; + $secon[$i] = 'quatre-vingts'; + $prim[$i] = $chif[$unite[$i] + 10]; } } - if($cent[$i]==1) $trio[$i]='cent'; - elseif($cent[$i]!=0 || $cent[$i]!='') $trio[$i]=$chif[$cent[$i]] .' cents'; + if ($cent[$i] == 1) $trio[$i] = 'cent'; + elseif ($cent[$i] != 0 || $cent[$i] != '') $trio[$i] = $chif[$cent[$i]].' cents'; } - $chif2=array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix'); - $secon_c=$chif2[$dix_c]; - if ($cent_c==1) $trio_c='cent'; - elseif ($cent_c!=0 || $cent_c!='') $trio_c=$chif[$cent_c] .' cents'; + $chif2 = array('', 'dix', 'vingt', 'trente', 'quarante', 'cinquante', 'soixante', 'soixante-dix', 'quatre-vingts', 'quatre-vingts dix'); + $secon_c = $chif2[$dix_c]; + if ($cent_c == 1) $trio_c = 'cent'; + elseif ($cent_c != 0 || $cent_c != '') $trio_c = $chif[$cent_c].' cents'; - if (($cent[3]==0 || $cent[3]=='') && ($dix[3]==0 || $dix[3]=='') && ($unite[3]==1)) - $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' million '; - elseif (($cent[3]!=0 && $cent[3]!='') || ($dix[3]!=0 && $dix[3]!='') || ($unite[3]!=0 && $unite[3]!='')) - $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]. ' millions '; + if (($cent[3] == 0 || $cent[3] == '') && ($dix[3] == 0 || $dix[3] == '') && ($unite[3] == 1)) + $somme = $trio[3].' '.$secon[3].' '.$prim[3].' million '; + elseif (($cent[3] != 0 && $cent[3] != '') || ($dix[3] != 0 && $dix[3] != '') || ($unite[3] != 0 && $unite[3] != '')) + $somme = $trio[3].' '.$secon[3].' '.$prim[3].' millions '; else - $somme = $trio[3]. ' ' .$secon[3]. ' ' . $prim[3]; + $somme = $trio[3].' '.$secon[3].' '.$prim[3]; - if (($cent[2]==0 || $cent[2]=='') && ($dix[2]==0 || $dix[2]=='') && ($unite[2]==1)) + if (($cent[2] == 0 || $cent[2] == '') && ($dix[2] == 0 || $dix[2] == '') && ($unite[2] == 1)) $somme = $somme.' mille '; - elseif (($cent[2]!=0 && $cent[2]!='') || ($dix[2]!=0 && $dix[2]!='') || ($unite[2]!=0 && $unite[2]!='')) - $somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]. ' milles '; + elseif (($cent[2] != 0 && $cent[2] != '') || ($dix[2] != 0 && $dix[2] != '') || ($unite[2] != 0 && $unite[2] != '')) + $somme = $somme.$trio[2].' '.$secon[2].' '.$prim[2].' milles '; else - $somme = $somme. $trio[2]. ' ' .$secon[2]. ' ' . $prim[2]; + $somme = $somme.$trio[2].' '.$secon[2].' '.$prim[2]; - $somme = $somme. $trio[1]. ' ' .$secon[1]. ' ' . $prim[1]; + $somme = $somme.$trio[1].' '.$secon[1].' '.$prim[1]; - $somme = $somme. ' '. $dev1 .' ' ; + $somme = $somme.' '.$dev1.' '; - if (($cent_c=='0' || $cent_c=='') && ($dix_c=='0' || $dix_c=='')) - return $somme. ' et zéro '. $dev2; + if (($cent_c == '0' || $cent_c == '') && ($dix_c == '0' || $dix_c == '')) + return $somme.' et zéro '.$dev2; else - return $somme. $trio_c. ' ' .$secon_c. ' ' . $dev2; + return $somme.$trio_c.' '.$secon_c.' '.$dev2; } } diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index ef05b9b2df9..01070a6a6c7 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -41,7 +41,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures { /** * Issuer - * @var Company object that emits + * @var Societe Object that emits */ public $emetteur; diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 7dc9aa245e9..d7b8296db33 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -494,7 +494,7 @@ class pdf_crabe extends ModelePDFFactures $curY = $tab_top_newpage; // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -539,7 +539,7 @@ class pdf_crabe extends ModelePDFFactures // We found a page break // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -1051,15 +1051,15 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell(80, 5, $lib_mode_reg, 0, 'L'); // Show online payment link - $useonlinepayment = ((! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)); + $useonlinepayment = ((!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)) && !empty($conf->global->PDF_SHOW_LINK_TO_ONLINE_PAYMENT)); if (($object->mode_reglement_code == 'CB' || $object->mode_reglement_code == 'VAD') && $object->statut != Facture::STATUS_DRAFT && $useonlinepayment) { require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; global $langs; $langs->loadLangs(array('payment', 'paybox')); - $servicename=$langs->transnoentities('Online'); + $servicename = $langs->transnoentities('Online'); $paiement_url = getOnlinePaymentUrl('', 'invoice', $object->ref, '', '', ''); - $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; + $linktopay = $langs->trans("ToOfferALinkForOnlinePayment", $servicename).' '.$outputlangs->transnoentities("ClickHere").''; $pdf->writeHTMLCell(80, 10, '', '', dol_htmlentitiesbr($linktopay), 0, 1); } @@ -1693,27 +1693,27 @@ class pdf_crabe extends ModelePDFFactures $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 82a55fbf319..9c12b79215f 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -1944,27 +1944,27 @@ class pdf_sponge extends ModelePDFFactures $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index ff7bff51230..ff913d724f8 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -108,7 +108,7 @@ class pdf_soleil extends ModelePDFFicheinter /** * Issuer - * @var Company object that emits + * @var Societe Object that emits */ public $emetteur; diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index e8d2aeff63e..f2f3a135785 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -46,7 +46,7 @@ class mod_arctic extends ModeleNumRefFicheinter /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom = 'arctic'; diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index 97784ce0639..3ecd3d6833d 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -46,7 +46,7 @@ class mod_pacific extends ModeleNumRefFicheinter /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='pacific'; diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 93d68691a11..6c9dd9062a8 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -425,6 +425,7 @@ class ImportCsv extends ModeleImports // New val can be an id or ref. If it start with id: it is forced to id, if it start with ref: it is forced to ref. It not, we try to guess. $isidorref = 'id'; if (!is_numeric($newval) && $newval != '' && !preg_match('/^id:/i', $newval)) $isidorref = 'ref'; + $newval = preg_replace('/^(id|ref):/i', '', $newval); // Remove id: or ref: that was used to force if field is id or ref //print 'Val is now '.$newval.' and is type '.$isidorref."
\n"; @@ -448,8 +449,7 @@ class ImportCsv extends ModeleImports $classinstance = new $class($this->db); // Try the fetch from code or ref $param_array = array('', $newval); - if ($class == 'AccountingAccount') - { + if ($class == 'AccountingAccount') { //var_dump($arrayrecord[0]['val']); /*include_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancysystem.class.php'; $tmpchartofaccount = new AccountancySystem($this->db); @@ -464,6 +464,7 @@ class ImportCsv extends ModeleImports }*/ $param_array = array('', $newval, 0, $arrayrecord[0]['val']); // Param to fetch parent from account, in chart. } + call_user_func_array(array($classinstance, $method), $param_array); // If not found, try the fetch from label if (! ($classinstance->id != '') && $objimport->array_import_convertvalue[0][$val]['rule']=='fetchidfromcodeorlabel') diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index 9c80c6a9020..cdbb2cd0bb7 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -107,7 +107,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder /** * Issuer - * @var Company object that emits + * @var Societe Object that emits */ public $emetteur; diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index b53a9630598..61a4dd67d5c 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -24,7 +24,7 @@ * \ingroup category * \brief Fichier de description et activation du module Categorie */ -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** @@ -64,11 +64,11 @@ class modCategorie extends DolibarrModules // Config pages $this->config_page_url = array('categorie.php@categories'); - $this->langfiles = array("products","companies","categories","members"); + $this->langfiles = array("products", "companies", "categories", "members"); // Constants $this->const = array(); - $r=0; + $r = 0; $this->const[$r][0] = "CATEGORIE_RECURSIV_ADD"; $this->const[$r][1] = "yesno"; $this->const[$r][2] = "0"; @@ -83,7 +83,7 @@ class modCategorie extends DolibarrModules $this->rights = array(); $this->rights_class = 'categorie'; - $r=0; + $r = 0; $this->rights[$r][0] = 241; // id de la permission $this->rights[$r][1] = 'Lire les categories'; // libelle de la permission @@ -109,115 +109,115 @@ class modCategorie extends DolibarrModules // Menus //------- - $this->menu = 1; // This module add menu entries. They are coded into menu manager. + $this->menu = 1; // This module add menu entries. They are coded into menu manager. // Exports //-------- - $r=0; + $r = 0; $r++; - $this->export_code[$r]='category_'.$r; - $this->export_label[$r]='CatSupList'; - $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->fournisseur->enabled'; - $this->export_permission[$r]=array(array("categorie","lire"),array("fournisseur","lire")); - $this->export_fields_array[$r]=array( - 'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix", - 's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address", - 's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email", - 's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital", + $this->export_code[$r] = 'category_'.$r; + $this->export_label[$r] = 'CatSupList'; + $this->export_icon[$r] = 'category'; + $this->export_enabled[$r] = '$conf->fournisseur->enabled'; + $this->export_permission[$r] = array(array("categorie", "lire"), array("fournisseur", "lire")); + $this->export_fields_array[$r] = array( + 'u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", + 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address", + 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", + 's.siret'=>"ProfId1", 's.siren'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital", 's.note_public'=>"NotePublic" ); - $this->export_TypeFields_array[$r]=array( - 'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text",'s.datec'=>"Date", - 's.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label",'c.code'=>"Text", - 's.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text",'s.idprof4'=>"Text", - 's.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text" + $this->export_TypeFields_array[$r] = array( + 'u.label'=>"Text", 'u.description'=>"Text", 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", 's.datec'=>"Date", + 's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", 'c.code'=>"Text", + 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", 's.idprof4'=>"Text", + 's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_public'=>"Text" ); - $this->export_entities_array[$r]=array( - 's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company", - 's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company", - 's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company", - 's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company" - ); // We define here only fields that use another picto - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '; + $this->export_entities_array[$r] = array( + 's.rowid'=>'company', 's.nom'=>'company', 's.prefix_comm'=>"company", 's.client'=>"company", 's.datec'=>"company", 's.tms'=>"company", + 's.code_client'=>"company", 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 'c.label'=>"company", 'c.code'=>"company", + 's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company", 's.siret'=>"company", 's.siren'=>"company", 's.ape'=>"company", + 's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company" + ); // We define here only fields that use another picto + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '; $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_fournisseur as cf, '; $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code'; - $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; - $this->export_sql_end[$r] .=' AND u.type = 1'; // Supplier categories + $this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; + $this->export_sql_end[$r] .= ' AND u.type = 1'; // Supplier categories $r++; - $this->export_code[$r]='category_'.$r; - $this->export_label[$r]='CatCusList'; - $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->societe->enabled'; - $this->export_permission[$r]=array(array("categorie","lire"),array("societe","lire")); - $this->export_fields_array[$r]=array( - 'u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'s.rowid'=>'IdThirdParty','s.nom'=>'Name','s.prefix_comm'=>"Prefix", - 's.client'=>"Customer",'s.datec'=>"DateCreation",'s.tms'=>"DateLastModification",'s.code_client'=>"CustomerCode",'s.address'=>"Address", - 's.zip'=>"Zip",'s.town'=>"Town",'c.label'=>"Country",'c.code'=>"CountryCode",'s.phone'=>"Phone",'s.fax'=>"Fax",'s.url'=>"Url",'s.email'=>"Email", - 's.siret'=>"ProfId1",'s.siren'=>"ProfId2",'s.ape'=>"ProfId3",'s.idprof4'=>"ProfId4",'s.tva_intra'=>"VATIntraShort",'s.capital'=>"Capital", - 's.note_public'=>"NotePublic",'s.fk_prospectlevel'=>'ProspectLevel','s.fk_stcomm'=>'ProspectStatus' + $this->export_code[$r] = 'category_'.$r; + $this->export_label[$r] = 'CatCusList'; + $this->export_icon[$r] = 'category'; + $this->export_enabled[$r] = '$conf->societe->enabled'; + $this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "lire")); + $this->export_fields_array[$r] = array( + 'u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 's.rowid'=>'IdThirdParty', 's.nom'=>'Name', 's.prefix_comm'=>"Prefix", + 's.client'=>"Customer", 's.datec'=>"DateCreation", 's.tms'=>"DateLastModification", 's.code_client'=>"CustomerCode", 's.address'=>"Address", + 's.zip'=>"Zip", 's.town'=>"Town", 'c.label'=>"Country", 'c.code'=>"CountryCode", 's.phone'=>"Phone", 's.fax'=>"Fax", 's.url'=>"Url", 's.email'=>"Email", + 's.siret'=>"ProfId1", 's.siren'=>"ProfId2", 's.ape'=>"ProfId3", 's.idprof4'=>"ProfId4", 's.tva_intra'=>"VATIntraShort", 's.capital'=>"Capital", + 's.note_public'=>"NotePublic", 's.fk_prospectlevel'=>'ProspectLevel', 's.fk_stcomm'=>'ProspectStatus' ); - $this->export_TypeFields_array[$r]=array( - 'u.label'=>"Text",'u.description'=>"Text",'s.rowid'=>'List:societe:nom','s.nom'=>'Text','s.prefix_comm'=>"Text",'s.client'=>"Text", - 's.datec'=>"Date",'s.tms'=>"Date",'s.code_client'=>"Text",'s.address'=>"Text",'s.zip'=>"Text",'s.town'=>"Text",'c.label'=>"List:c_country:label:label", - 'c.code'=>"Text",'s.phone'=>"Text",'s.fax'=>"Text",'s.url'=>"Text",'s.email'=>"Text",'s.siret'=>"Text",'s.siren'=>"Text",'s.ape'=>"Text", - 's.idprof4'=>"Text",'s.tva_intra'=>"Text",'s.capital'=>"Numeric",'s.note_public'=>"Text",'s.fk_prospectlevel'=>'List:c_prospectlevel:label:code', + $this->export_TypeFields_array[$r] = array( + 'u.label'=>"Text", 'u.description'=>"Text", 's.rowid'=>'List:societe:nom', 's.nom'=>'Text', 's.prefix_comm'=>"Text", 's.client'=>"Text", + 's.datec'=>"Date", 's.tms'=>"Date", 's.code_client'=>"Text", 's.address'=>"Text", 's.zip'=>"Text", 's.town'=>"Text", 'c.label'=>"List:c_country:label:label", + 'c.code'=>"Text", 's.phone'=>"Text", 's.fax'=>"Text", 's.url'=>"Text", 's.email'=>"Text", 's.siret'=>"Text", 's.siren'=>"Text", 's.ape'=>"Text", + 's.idprof4'=>"Text", 's.tva_intra'=>"Text", 's.capital'=>"Numeric", 's.note_public'=>"Text", 's.fk_prospectlevel'=>'List:c_prospectlevel:label:code', 's.fk_stcomm'=>'List:c_stcomm:libelle:code' ); - $this->export_entities_array[$r]=array( - 's.rowid'=>'company','s.nom'=>'company','s.prefix_comm'=>"company",'s.client'=>"company",'s.datec'=>"company",'s.tms'=>"company", - 's.code_client'=>"company",'s.address'=>"company",'s.zip'=>"company",'s.town'=>"company",'c.label'=>"company",'c.code'=>"company", - 's.phone'=>"company",'s.fax'=>"company",'s.url'=>"company",'s.email'=>"company",'s.siret'=>"company",'s.siren'=>"company",'s.ape'=>"company", - 's.idprof4'=>"company",'s.tva_intra'=>"company",'s.capital'=>"company",'s.note_public'=>"company",'s.fk_prospectlevel'=>'company', + $this->export_entities_array[$r] = array( + 's.rowid'=>'company', 's.nom'=>'company', 's.prefix_comm'=>"company", 's.client'=>"company", 's.datec'=>"company", 's.tms'=>"company", + 's.code_client'=>"company", 's.address'=>"company", 's.zip'=>"company", 's.town'=>"company", 'c.label'=>"company", 'c.code'=>"company", + 's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company", 's.siret'=>"company", 's.siren'=>"company", 's.ape'=>"company", + 's.idprof4'=>"company", 's.tva_intra'=>"company", 's.capital'=>"company", 's.note_public'=>"company", 's.fk_prospectlevel'=>'company', 's.fk_stcomm'=>'company' - ); // We define here only fields that use another picto - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '; + ); // We define here only fields that use another picto + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '; $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'categorie_societe as cf, '; $this->export_sql_end[$r] .= MAIN_DB_PREFIX.'societe as s LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as t ON s.fk_typent = t.id LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as ce ON s.fk_effectif = ce.id LEFT JOIN '.MAIN_DB_PREFIX.'c_forme_juridique as cfj ON s.fk_forme_juridique = cfj.code LEFT JOIN '.MAIN_DB_PREFIX.'societe_extrafields as extra ON s.rowid = extra.fk_object '; - $this->export_sql_end[$r] .=' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; - $this->export_sql_end[$r] .=' AND u.type = 2'; // Customer/Prospect categories + $this->export_sql_end[$r] .= ' WHERE u.rowid = cf.fk_categorie AND cf.fk_soc = s.rowid'; + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; + $this->export_sql_end[$r] .= ' AND u.type = 2'; // Customer/Prospect categories // Add extra fields - $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; - $resql=$this->db->query($sql); + $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'societe' AND entity IN (0, ".$conf->entity.")"; + $resql = $this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) + $fieldname = 'extra.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $typeFilter = "Text"; + switch ($obj->type) { case 'int': case 'double': case 'price': - $typeFilter="Numeric"; + $typeFilter = "Numeric"; break; case 'date': case 'datetime': - $typeFilter="Date"; + $typeFilter = "Date"; break; case 'boolean': - $typeFilter="Boolean"; + $typeFilter = "Boolean"; break; case 'sellist': - $typeFilter="List:".$obj->param; + $typeFilter = "List:".$obj->param; break; case 'select': - $typeFilter="Select:".$obj->param; + $typeFilter = "Select:".$obj->param; break; } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='company'; + $this->export_fields_array[$r][$fieldname] = $fieldlabel; + $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; + $this->export_entities_array[$r][$fieldname] = 'company'; } } // End add axtra fields @@ -227,42 +227,42 @@ class modCategorie extends DolibarrModules $r++; - $this->export_code[$r]='category_'.$r; - $this->export_label[$r]='CatProdList'; - $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->product->enabled || $conf->service->enabled'; - $this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire")); - $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref'); - $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text'); - $this->export_entities_array[$r]=array('p.rowid'=>'product','p.ref'=>'product'); // We define here only fields that use another picto - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p'; - $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid'; - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; - $this->export_sql_end[$r] .=' AND u.type = 0'; // Supplier categories + $this->export_code[$r] = 'category_'.$r; + $this->export_label[$r] = 'CatProdList'; + $this->export_icon[$r] = 'category'; + $this->export_enabled[$r] = '$conf->product->enabled || $conf->service->enabled'; + $this->export_permission[$r] = array(array("categorie", "lire"), array("produit", "lire")); + $this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 'p.rowid'=>'ProductId', 'p.ref'=>'Ref'); + $this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 'p.ref'=>'Text'); + $this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product'); // We define here only fields that use another picto + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_product as cp, '.MAIN_DB_PREFIX.'product as p'; + $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_product = p.rowid'; + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; + $this->export_sql_end[$r] .= ' AND u.type = 0'; // Supplier categories $r++; - $this->export_code[$r]='category_'.$r; - $this->export_label[$r]='CatMemberList'; - $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->adherent->enabled'; - $this->export_permission[$r]=array(array("categorie","lire"),array("adherent","lire")); - $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'MemberId','p.lastname'=>'LastName','p.firstname'=>'Firstname'); - $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.lastname'=>'Text','p.firstname'=>'Text'); - $this->export_entities_array[$r]=array('p.rowid'=>'member','p.lastname'=>'member','p.firstname'=>'member'); // We define here only fields that use another picto - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; - $this->export_sql_end[$r] .=' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid'; - $this->export_sql_end[$r] .=' AND u.entity IN ('.getEntity('category').')'; - $this->export_sql_end[$r] .=' AND u.type = 3'; // Member categories + $this->export_code[$r] = 'category_'.$r; + $this->export_label[$r] = 'CatMemberList'; + $this->export_icon[$r] = 'category'; + $this->export_enabled[$r] = '$conf->adherent->enabled'; + $this->export_permission[$r] = array(array("categorie", "lire"), array("adherent", "lire")); + $this->export_fields_array[$r] = array('u.rowid'=>"CategId", 'u.label'=>"Label", 'u.description'=>"Description", 'p.rowid'=>'MemberId', 'p.lastname'=>'LastName', 'p.firstname'=>'Firstname'); + $this->export_TypeFields_array[$r] = array('u.label'=>"Text", 'u.description'=>"Text", 'p.lastname'=>'Text', 'p.firstname'=>'Text'); + $this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_member as cp, '.MAIN_DB_PREFIX.'adherent as p'; + $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_member = p.rowid'; + $this->export_sql_end[$r] .= ' AND u.entity IN ('.getEntity('category').')'; + $this->export_sql_end[$r] .= ' AND u.type = 3'; // Member categories $r++; - $this->export_code[$r]='category_'.$r; - $this->export_label[$r]='CatContactList'; - $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->societe->enabled'; - $this->export_permission[$r]=array(array("categorie", "lire"), array ("societe", "lire")); - $this->export_fields_array[$r]=array ( + $this->export_code[$r] = 'category_'.$r; + $this->export_label[$r] = 'CatContactList'; + $this->export_icon[$r] = 'category'; + $this->export_enabled[$r] = '$conf->societe->enabled'; + $this->export_permission[$r] = array(array("categorie", "lire"), array("societe", "lire")); + $this->export_fields_array[$r] = array( 'u.rowid' => "CategId", 'u.label' => "Label", 'u.description' => "Description", @@ -297,7 +297,7 @@ class modCategorie extends DolibarrModules 's.url'=>"Url", 's.email'=>"Email" ); - $this->export_TypeFields_array[$r] = array ( + $this->export_TypeFields_array[$r] = array( 'u.label' => "Text", 'u.description' => "Text", 'p.lastname' => 'Text', @@ -313,7 +313,7 @@ class modCategorie extends DolibarrModules 's.url'=>"Text", 's.email'=>"Text" ); - $this->export_entities_array[$r] = array ( + $this->export_entities_array[$r] = array( 'u.rowid' => "category", 'u.label' => "category", 'u.description' => "category", @@ -350,67 +350,67 @@ class modCategorie extends DolibarrModules ); // We define here only fields that use another picto // Add extra fields - $sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; - $resql=$this->db->query($sql); + $sql = "SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'socpeople' AND entity IN (0, ".$conf->entity.")"; + $resql = $this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $typeFilter="Text"; - switch($obj->type) + $fieldname = 'extra.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $typeFilter = "Text"; + switch ($obj->type) { case 'int': case 'double': case 'price': - $typeFilter="Numeric"; + $typeFilter = "Numeric"; break; case 'date': case 'datetime': - $typeFilter="Date"; + $typeFilter = "Date"; break; case 'boolean': - $typeFilter="Boolean"; + $typeFilter = "Boolean"; break; case 'sellist': - $typeFilter="List:".$obj->param; + $typeFilter = "List:".$obj->param; break; case 'select': - $typeFilter="Select:".$obj->param; + $typeFilter = "Select:".$obj->param; break; } - $this->export_fields_array[$r][$fieldname]=$fieldlabel; - $this->export_TypeFields_array[$r][$fieldname]=$typeFilter; - $this->export_entities_array[$r][$fieldname]='contact'; + $this->export_fields_array[$r][$fieldname] = $fieldlabel; + $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; + $this->export_entities_array[$r][$fieldname] = 'contact'; } } // End add axtra fields $this->export_sql_start[$r] = 'SELECT DISTINCT '; - $this->export_sql_end[$r] = ' FROM ' . MAIN_DB_PREFIX . 'categorie as u, '.MAIN_DB_PREFIX . 'categorie_contact as cp, '.MAIN_DB_PREFIX . 'socpeople as p'; - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'c_country as country ON p.fk_pays = country.rowid'; - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'societe as s ON s.rowid = p.fk_soc'; - $this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'socpeople_extrafields as extra ON extra.fk_object = p.rowid'; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'categorie as u, '.MAIN_DB_PREFIX.'categorie_contact as cp, '.MAIN_DB_PREFIX.'socpeople as p'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as country ON p.fk_pays = country.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON s.rowid = p.fk_soc'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople_extrafields as extra ON extra.fk_object = p.rowid'; $this->export_sql_end[$r] .= ' WHERE u.rowid = cp.fk_categorie AND cp.fk_socpeople = p.rowid AND u.entity IN ('.getEntity('category').')'; $this->export_sql_end[$r] .= ' AND u.type = 4'; // contact categories // Imports //-------- - $r=0; + $r = 0; $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="CatList"; // Translation key - $this->import_icon[$r]=$this->picto; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('ca'=>MAIN_DB_PREFIX.'categorie'); - $this->import_fields_array[$r]=array( - 'ca.label'=>"Label*",'ca.type'=>"Type*",'ca.description'=>"Description", + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "CatList"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('ca'=>MAIN_DB_PREFIX.'categorie'); + $this->import_fields_array[$r] = array( + 'ca.label'=>"Label*", 'ca.type'=>"Type*", 'ca.description'=>"Description", 'ca.fk_parent' => 'Parent' ); - $this->import_regex_array[$r]=array('ca.type'=>'^[0|1|2|3]'); + $this->import_regex_array[$r] = array('ca.type'=>'^[0|1|2|3]'); $this->import_convertvalue_array[$r] = array( 'ca.fk_parent' => array( 'rule' => 'fetchidfromcodeandlabel', @@ -421,77 +421,96 @@ class modCategorie extends DolibarrModules 'codefromfield' => 'ca.type' ) ); - $typeexample=""; - if ($conf->product->enabled) { $typeexample.=($typeexample?"/":"")."0=Product"; } - if ($conf->fournisseur->enabled) { $typeexample.=($typeexample?"/":"")."1=Supplier"; } - if ($conf->societe->enabled) { $typeexample.=($typeexample?"/":"")."2=Customer-Prospect"; } - if ($conf->adherent->enabled) { $typeexample.=($typeexample?"/":"")."3=Member"; } + $typeexample = ""; + if ($conf->product->enabled) { $typeexample .= ($typeexample ? "/" : "")."0=Product"; } + if ($conf->fournisseur->enabled) { $typeexample .= ($typeexample ? "/" : "")."1=Supplier"; } + if ($conf->societe->enabled) { $typeexample .= ($typeexample ? "/" : "")."2=Customer-Prospect"; } + if ($conf->adherent->enabled) { $typeexample .= ($typeexample ? "/" : "")."3=Member"; } $this->import_examplevalues_array[$r] = array( - 'ca.label'=>"Supplier Category",'ca.type'=>$typeexample,'ca.description'=>"My Category description", + 'ca.label'=>"Supplier Category", 'ca.type'=>$typeexample, 'ca.description'=>"My Category description", 'ca.fk_parent' => '0' ); - if (! empty($conf->product->enabled)) + if (!empty($conf->product->enabled)) { //Products $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="CatProdLinks"; // Translation key - $this->import_icon[$r]=$this->picto; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('cp'=>MAIN_DB_PREFIX.'categorie_product'); - $this->import_fields_array[$r]=array('cp.fk_categorie'=>"Category*",'cp.fk_product'=>"Product*"); - $this->import_regex_array[$r]=array('cp.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=0'); + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "CatProdLinks"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('cp'=>MAIN_DB_PREFIX.'categorie_product'); + $this->import_fields_array[$r] = array('cp.fk_categorie'=>"Category*", 'cp.fk_product'=>"Product*"); + $this->import_regex_array[$r] = array('cp.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=0'); - $this->import_convertvalue_array[$r]=array( - 'cp.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), - 'cp.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product') + $this->import_convertvalue_array[$r] = array( + 'cp.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'), + 'cp.fk_product'=>array('rule'=>'fetchidfromref', 'classfile'=>'/product/class/product.class.php', 'class'=>'Product', 'method'=>'fetch', 'element'=>'product') ); - $this->import_examplevalues_array[$r]=array('cp.fk_categorie'=>"Imported category",'cp.fk_product'=>"PREF123456"); + $this->import_examplevalues_array[$r] = array('cp.fk_categorie'=>"Imported category", 'cp.fk_product'=>"PREF123456"); } - if (! empty($conf->societe->enabled)) + if (!empty($conf->societe->enabled)) { - //Customers + // Customers $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="CatCusLinks"; // Translation key - $this->import_icon[$r]=$this->picto; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_societe'); - $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"ThirdParty*"); - $this->import_regex_array[$r]=array( + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "CatCusLinks"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_societe'); + $this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_soc'=>"ThirdParty*"); + $this->import_regex_array[$r] = array( 'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=2', 'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:client>0' ); - $this->import_convertvalue_array[$r]=array( - 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), - 'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') + $this->import_convertvalue_array[$r] = array( + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'), + 'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty') ); - $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany"); + $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany"); + + // Contacts/Addresses + $r++; + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "CatContactsLinks"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_contact'); + $this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_socpeople'=>"Contact ID*"); + $this->import_regex_array[$r] = array( + 'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=4' + //'cs.fk_socpeople'=>'rowid@'.MAIN_DB_PREFIX.'socpeople' + ); + + $this->import_convertvalue_array[$r] = array( + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category') + //'cs.fk_socpeople'=>array('rule'=>'fetchidfromref','classfile'=>'/contact/class/contact.class.php','class'=>'Contact','method'=>'fetch','element'=>'Contact') + ); + $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_socpeople'=>"123"); } - if (! empty($conf->fournisseur->enabled)) + if (!empty($conf->fournisseur->enabled)) { // Suppliers $r++; - $this->import_code[$r]=$this->rights_class.'_'.$r; - $this->import_label[$r]="CatSupLinks"; // Translation key - $this->import_icon[$r]=$this->picto; - $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur'); - $this->import_fields_array[$r]=array('cs.fk_categorie'=>"Category*",'cs.fk_soc'=>"Supplier*"); - $this->import_regex_array[$r]=array( + $this->import_code[$r] = $this->rights_class.'_'.$r; + $this->import_label[$r] = "CatSupLinks"; // Translation key + $this->import_icon[$r] = $this->picto; + $this->import_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('cs'=>MAIN_DB_PREFIX.'categorie_fournisseur'); + $this->import_fields_array[$r] = array('cs.fk_categorie'=>"Category*", 'cs.fk_soc'=>"Supplier*"); + $this->import_regex_array[$r] = array( 'cs.fk_categorie'=>'rowid@'.MAIN_DB_PREFIX.'categorie:type=1', 'cs.fk_soc'=>'rowid@'.MAIN_DB_PREFIX.'societe:fournisseur>0' ); - $this->import_convertvalue_array[$r]=array( - 'cs.fk_categorie'=>array('rule'=>'fetchidfromref','classfile'=>'/categories/class/categorie.class.php','class'=>'Categorie','method'=>'fetch','element'=>'category'), - 'cs.fk_soc'=>array('rule'=>'fetchidfromref','classfile'=>'/societe/class/societe.class.php','class'=>'Societe','method'=>'fetch','element'=>'ThirdParty') + $this->import_convertvalue_array[$r] = array( + 'cs.fk_categorie'=>array('rule'=>'fetchidfromref', 'classfile'=>'/categories/class/categorie.class.php', 'class'=>'Categorie', 'method'=>'fetch', 'element'=>'category'), + 'cs.fk_soc'=>array('rule'=>'fetchidfromref', 'classfile'=>'/societe/class/societe.class.php', 'class'=>'Societe', 'method'=>'fetch', 'element'=>'ThirdParty') ); - $this->import_examplevalues_array[$r]=array('cs.fk_categorie'=>"Imported category",'cs.fk_soc'=>"MyBigCompany"); + $this->import_examplevalues_array[$r] = array('cs.fk_categorie'=>"Imported category", 'cs.fk_soc'=>"MyBigCompany"); } } diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index aa68fdeb698..77d339da035 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -28,7 +28,7 @@ * \ingroup projet * \brief Fichier de description et activation du module Projet */ -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** @@ -58,22 +58,22 @@ class modProjet extends DolibarrModules $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->config_page_url = array("project.php@projet"); - $this->picto='project'; + $this->picto = 'project'; // Data directories to create when module is enabled $this->dirs = array("/projet/temp"); // Dependencies - $this->hidden = false; // A condition to hide module - $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled - $this->requiredby = array(); // List of module ids to disable if this one is disabled - $this->conflictwith = array(); // List of module class names as string this module is in conflict with - $this->phpmin = array(5,4); // Minimum version of PHP required by module + $this->hidden = false; // A condition to hide module + $this->depends = array(); // List of module class names as string that must be enabled if this module is enabled + $this->requiredby = array(); // List of module ids to disable if this one is disabled + $this->conflictwith = array(); // List of module class names as string this module is in conflict with + $this->phpmin = array(5, 4); // Minimum version of PHP required by module $this->langfiles = array('projects'); // Constants $this->const = array(); - $r=0; + $r = 0; $this->const[$r][0] = "PROJECT_ADDON_PDF"; $this->const[$r][1] = "chaine"; @@ -139,7 +139,7 @@ class modProjet extends DolibarrModules // Boxes $this->boxes = array(); - $r=0; + $r = 0; $this->boxes[$r][1] = "box_project.php"; $r++; $this->boxes[$r][1] = "box_task.php"; @@ -148,7 +148,7 @@ class modProjet extends DolibarrModules // Permissions $this->rights = array(); $this->rights_class = 'projet'; - $r=0; + $r = 0; $r++; $this->rights[$r][0] = 41; // id de la permission @@ -205,43 +205,43 @@ class modProjet extends DolibarrModules // Menus //------- - $this->menu = 1; // This module add menu entries. They are coded into menu manager. + $this->menu = 1; // This module add menu entries. They are coded into menu manager. //Exports //-------- - $r=1; + $r = 1; - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_permission[$r]=array(array("projet","export")); - $this->export_dependencies_array[$r]=array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid'); + $this->export_code[$r] = $this->rights_class.'_'.$r; + $this->export_label[$r] = 'ProjectsAndTasksLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_permission[$r] = array(array("projet", "export")); + $this->export_dependencies_array[$r] = array('projecttask'=>'pt.rowid', 'task_time'=>'ptt.rowid'); - $this->export_TypeFields_array[$r]=array( - 's.rowid'=>"List:societe:nom::thirdparty",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','s.fk_pays'=>'List:c_country:label', - 's.phone'=>'Text','s.email'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text', - 'p.rowid'=>"List:projet:ref::project",'p.ref'=>"Text",'p.title'=>"Text", + $this->export_TypeFields_array[$r] = array( + 's.rowid'=>"List:societe:nom::thirdparty", 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 's.fk_pays'=>'List:c_country:label', + 's.phone'=>'Text', 's.email'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', + 'p.rowid'=>"List:projet:ref::project", 'p.ref'=>"Text", 'p.title'=>"Text", 'p.usage_opportunity'=>'Boolean', 'p.usage_task'=>'Boolean', 'p.usage_bill_time'=>'Boolean', - 'p.datec'=>"Date",'p.dateo'=>"Date",'p.datee'=>"Date",'p.fk_statut'=>'Status','cls.code'=>"Text",'p.opp_percent'=>'Numeric','p.opp_amount'=>'Numeric','p.description'=>"Text",'p.entity'=>'Numeric', - 'pt.rowid'=>'Numeric','pt.ref'=>'Text','pt.label'=>'Text','pt.dateo'=>"Date",'pt.datee'=>"Date",'pt.duration_effective'=>"Duree",'pt.planned_workload'=>"Numeric",'pt.progress'=>"Numeric",'pt.description'=>"Text", - 'ptt.rowid'=>'Numeric','ptt.task_date'=>'Date','ptt.task_duration'=>"Duree",'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)",'ptt.note'=>"Text" + 'p.datec'=>"Date", 'p.dateo'=>"Date", 'p.datee'=>"Date", 'p.fk_statut'=>'Status', 'cls.code'=>"Text", 'p.opp_percent'=>'Numeric', 'p.opp_amount'=>'Numeric', 'p.description'=>"Text", 'p.entity'=>'Numeric', + 'pt.rowid'=>'Numeric', 'pt.ref'=>'Text', 'pt.label'=>'Text', 'pt.dateo'=>"Date", 'pt.datee'=>"Date", 'pt.duration_effective'=>"Duree", 'pt.planned_workload'=>"Numeric", 'pt.progress'=>"Numeric", 'pt.description'=>"Text", + 'ptt.rowid'=>'Numeric', 'ptt.task_date'=>'Date', 'ptt.task_duration'=>"Duree", 'ptt.fk_user'=>"List:user:CONCAT(lastname,' ',firstname)", 'ptt.note'=>"Text" ); - $this->export_entities_array[$r]=array( - 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company', - 's.phone'=>'company','s.email'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company' + $this->export_entities_array[$r] = array( + 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', 's.fk_pays'=>'company', + 's.phone'=>'company', 's.email'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company' ); - $this->export_fields_array[$r]=array( - 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country', - 's.phone'=>'Phone','s.email'=>'Email','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode', - 'p.rowid'=>"ProjectId",'p.ref'=>"RefProject",'p.title'=>'ProjectLabel', + $this->export_fields_array[$r] = array( + 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 's.fk_pays'=>'Country', + 's.phone'=>'Phone', 's.email'=>'Email', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', + 'p.rowid'=>"ProjectId", 'p.ref'=>"RefProject", 'p.title'=>'ProjectLabel', 'p.usage_opportunity'=>'ProjectFollowOpportunity', 'p.usage_task'=>'ProjectFollowTasks', 'p.usage_bill_time'=>'BillTime', - 'p.datec'=>"DateCreation",'p.dateo'=>"DateStart",'p.datee'=>"DateEnd",'p.fk_statut'=>'ProjectStatus','cls.code'=>'OpportunityStatus','p.opp_percent'=>'OpportunityProbability','p.opp_amount'=>'OpportunityAmount','p.description'=>"Description" + 'p.datec'=>"DateCreation", 'p.dateo'=>"DateStart", 'p.datee'=>"DateEnd", 'p.fk_statut'=>'ProjectStatus', 'cls.code'=>'OpportunityStatus', 'p.opp_percent'=>'OpportunityProbability', 'p.opp_amount'=>'OpportunityAmount', 'p.description'=>"Description" ); // Add multicompany field - if (! empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) + if (!empty($conf->global->MULTICOMPANY_ENTITY_IN_EXPORT_IF_SHARED)) { - $nbofallowedentities=count(explode(',', getEntity('project'))); // If project are shared, nb will be > 1 - if (! empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r]+=array('p.entity'=>'Entity'); + $nbofallowedentities = count(explode(',', getEntity('project'))); // If project are shared, nb will be > 1 + if (!empty($conf->multicompany->enabled) && $nbofallowedentities > 1) $this->export_fields_array[$r] += array('p.entity'=>'Entity'); } if (empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { @@ -251,68 +251,68 @@ class modProjet extends DolibarrModules } // Add fields for project - $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array()); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array()); // Add extra fields for project - $keyforselect='projet'; $keyforelement='project'; $keyforaliasextra='extra'; + $keyforselect = 'projet'; $keyforelement = 'project'; $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // Add fields for tasks - $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription")); - $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask', 'pt.ref'=>'projecttask', 'pt.label'=>'projecttask', 'pt.dateo'=>"projecttask", 'pt.datee'=>"projecttask", 'pt.duration_effective'=>"projecttask", 'pt.planned_workload'=>"projecttask", 'pt.progress'=>"projecttask", 'pt.description'=>"projecttask")); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription")); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask', 'pt.ref'=>'projecttask', 'pt.label'=>'projecttask', 'pt.dateo'=>"projecttask", 'pt.datee'=>"projecttask", 'pt.duration_effective'=>"projecttask", 'pt.planned_workload'=>"projecttask", 'pt.progress'=>"projecttask", 'pt.description'=>"projecttask")); // Add extra fields for task - $keyforselect='projet_task'; $keyforelement='projecttask'; $keyforaliasextra='extra2'; + $keyforselect = 'projet_task'; $keyforelement = 'projecttask'; $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add extra fields - $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime','ptt.task_date'=>'TaskTimeDate','ptt.task_duration'=>"TimesSpent",'ptt.fk_user'=>"TaskTimeUser",'ptt.note'=>"TaskTimeNote")); - $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time','ptt.task_date'=>'task_time','ptt.task_duration'=>"task_time",'ptt.fk_user'=>"task_time",'ptt.note'=>"task_time")); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime', 'ptt.task_date'=>'TaskTimeDate', 'ptt.task_duration'=>"TimesSpent", 'ptt.fk_user'=>"TaskTimeUser", 'ptt.note'=>"TaskTimeNote")); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('ptt.rowid'=>'task_time', 'ptt.task_date'=>'task_time', 'ptt.task_duration'=>"task_time", 'ptt.fk_user'=>"task_time", 'ptt.note'=>"task_time")); if (empty($conf->global->PROJECT_HIDE_TASKS)) { - $this->export_fields_array[$r]=array_merge($this->export_fields_array[$r], array('f.ref'=>"Billed")); - $this->export_entities_array[$r]=array_merge($this->export_entities_array[$r], array('f.ref'=>"task_time")); + $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('f.ref'=>"Billed")); + $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('f.ref'=>"task_time")); } - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'projet as p'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_lead_status as cls ON p.fk_opp_status = cls.rowid'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet"; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task"; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid'; + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'projet as p'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_extrafields as extra ON p.rowid = extra.fk_object'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_lead_status as cls ON p.fk_opp_status = cls.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet_task as pt ON p.rowid = pt.fk_projet"; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'projet_task_extrafields as extra2 ON pt.rowid = extra2.fk_object'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX."projet_task_time as ptt ON pt.rowid = ptt.fk_task"; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s ON p.fk_soc = s.rowid'; if (empty($conf->global->PROJECT_HIDE_TASKS)) { - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON ptt.invoice_id = f.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facture as f ON ptt.invoice_id = f.rowid'; } - $this->export_sql_end[$r] .=" WHERE p.entity IN (".getEntity('project').")"; + $this->export_sql_end[$r] .= " WHERE p.entity IN (".getEntity('project').")"; // Import list of tasks if (empty($conf->global->PROJECT_HIDE_TASKS)) { $r++; - $this->import_code[$r]='tasksofprojects'; - $this->import_label[$r]='ImportDatasetTasks'; - $this->import_icon[$r]='task'; - $this->import_entities_array[$r]=array('t.fk_projet'=>'project'); // We define here only fields that use another icon that the one defined into import_icon - $this->import_tables_array[$r]=array('t'=>MAIN_DB_PREFIX.'projet_task','extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order) - $this->import_fields_array[$r]=array('t.fk_projet'=>'ProjectRef*','t.ref'=>'RefTask*','t.label'=>'LabelTask*','t.dateo'=>"DateStart",'t.datee'=>"DateEnd",'t.planned_workload'=>"PlannedWorkload",'t.progress'=>"Progress",'t.note_private'=>"NotePrivate",'t.note_public'=>"NotePublic",'t.datec'=>"DateCreation"); + $this->import_code[$r] = 'tasksofprojects'; + $this->import_label[$r] = 'ImportDatasetTasks'; + $this->import_icon[$r] = 'task'; + $this->import_entities_array[$r] = array('t.fk_projet'=>'project'); // We define here only fields that use another icon that the one defined into import_icon + $this->import_tables_array[$r] = array('t'=>MAIN_DB_PREFIX.'projet_task', 'extra'=>MAIN_DB_PREFIX.'projet_task_extrafields'); // List of tables to insert into (insert done in same order) + $this->import_fields_array[$r] = array('t.fk_projet'=>'ProjectRef*', 't.ref'=>'RefTask*', 't.label'=>'LabelTask*', 't.dateo'=>"DateStart", 't.datee'=>"DateEnd", 't.planned_workload'=>"PlannedWorkload", 't.progress'=>"Progress", 't.note_private'=>"NotePrivate", 't.note_public'=>"NotePublic", 't.datec'=>"DateCreation"); // Add extra fields - $sql="SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")"; - $resql=$this->db->query($sql); + $sql = "SELECT name, label, fieldrequired FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'projet_task' AND entity IN (0,".$conf->entity.")"; + $resql = $this->db->query($sql); if ($resql) // This can fail when class is used on old database (during migration for example) { - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - $fieldname='extra.'.$obj->name; - $fieldlabel=ucfirst($obj->label); - $this->import_fields_array[$r][$fieldname]=$fieldlabel.($obj->fieldrequired?'*':''); + $fieldname = 'extra.'.$obj->name; + $fieldlabel = ucfirst($obj->label); + $this->import_fields_array[$r][$fieldname] = $fieldlabel.($obj->fieldrequired ? '*' : ''); } } // End add extra fields - $this->import_fieldshidden_array[$r]=array('t.fk_user_creat'=>'user->id','extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'projet_task'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) - $this->import_convertvalue_array[$r]=array( - 't.fk_projet'=>array('rule'=>'fetchidfromref','classfile'=>'/projet/class/project.class.php','class'=>'Project','method'=>'fetch','element'=>'Project'), + $this->import_fieldshidden_array[$r] = array('t.fk_user_creat'=>'user->id', 'extra.fk_object'=>'lastrowid-'.MAIN_DB_PREFIX.'projet_task'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_convertvalue_array[$r] = array( + 't.fk_projet'=>array('rule'=>'fetchidfromref', 'classfile'=>'/projet/class/project.class.php', 'class'=>'Project', 'method'=>'fetch', 'element'=>'Project'), 't.ref'=>array('rule'=>'getrefifauto') ); //$this->import_convertvalue_array[$r]=array('s.fk_soc'=>array('rule'=>'lastrowid',table='t'); - $this->import_regex_array[$r]=array('t.dateo'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datee'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$','t.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); - $this->import_examplevalues_array[$r]=array('t.fk_projet'=>'MyProjectRef','t.ref'=>"auto or TK2010-1234",'t.label'=>"My task",'t.progress'=>"0 (not started) to 100 (finished)",'t.datec'=>'1972-10-10','t.note_private'=>"My private note",'t.note_public'=>"My public note"); + $this->import_regex_array[$r] = array('t.dateo'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 't.datee'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$', 't.datec'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]( [0-9][0-9]:[0-9][0-9]:[0-9][0-9])?$'); + $this->import_examplevalues_array[$r] = array('t.fk_projet'=>'MyProjectRef', 't.ref'=>"auto or TK2010-1234", 't.label'=>"My task", 't.progress'=>"0 (not started) to 100 (finished)", 't.datec'=>'1972-10-10', 't.note_private'=>"My private note", 't.note_public'=>"My public note"); } } @@ -327,54 +327,54 @@ class modProjet extends DolibarrModules */ public function init($options = '') { - global $conf,$langs; + global $conf, $langs; // Permissions $this->remove($options); //ODT template for project - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/projects/template_project.odt'; - $dirodt=DOL_DATA_ROOT.'/doctemplates/projects'; - $dest=$dirodt.'/template_project.odt'; + $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/projects/template_project.odt'; + $dirodt = DOL_DATA_ROOT.'/doctemplates/projects'; + $dest = $dirodt.'/template_project.odt'; - if (file_exists($src) && ! file_exists($dest)) + if (file_exists($src) && !file_exists($dest)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_mkdir($dirodt); - $result=dol_copy($src, $dest, 0, 0); + $result = dol_copy($src, $dest, 0, 0); if ($result < 0) { $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); + $this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest); return 0; } } //ODT template for tasks - $src=DOL_DOCUMENT_ROOT.'/install/doctemplates/tasks/template_task_summary.odt'; - $dirodt=DOL_DATA_ROOT.'/doctemplates/tasks'; - $dest=$dirodt.'/template_task_summary.odt'; + $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/tasks/template_task_summary.odt'; + $dirodt = DOL_DATA_ROOT.'/doctemplates/tasks'; + $dest = $dirodt.'/template_task_summary.odt'; - if (file_exists($src) && ! file_exists($dest)) + if (file_exists($src) && !file_exists($dest)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; dol_mkdir($dirodt); - $result=dol_copy($src, $dest, 0, 0); + $result = dol_copy($src, $dest, 0, 0); if ($result < 0) { $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); + $this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest); return 0; } } $sql = array(); - $sql[] ="DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'task' AND entity = ".$conf->entity; - $sql[] ="INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','task',".$conf->entity.")"; - $sql[] ="DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'beluga' AND type = 'project' AND entity = ".$conf->entity; - $sql[] ="INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('beluga','project',".$conf->entity.")"; - $sql[] ="DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'baleine' AND type = 'project' AND entity = ".$conf->entity; - $sql[] ="INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('baleine','project',".$conf->entity.")"; + $sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape($this->const[3][2])."' AND type = 'task' AND entity = ".$conf->entity; + $sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape($this->const[3][2])."','task',".$conf->entity.")"; + $sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'beluga' AND type = 'project' AND entity = ".$conf->entity; + $sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('beluga','project',".$conf->entity.")"; + $sql[] = "DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'baleine' AND type = 'project' AND entity = ".$conf->entity; + $sql[] = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('baleine','project',".$conf->entity.")"; return $this->_init($sql, $options); diff --git a/htdocs/core/modules/modTakePos.class.php b/htdocs/core/modules/modTakePos.class.php index 804ce8152ab..4671f40dd40 100644 --- a/htdocs/core/modules/modTakePos.class.php +++ b/htdocs/core/modules/modTakePos.class.php @@ -265,6 +265,10 @@ class modTakePos extends DolibarrModules */ public function init($options = '') { + global $conf,$db; + + dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", "browser", 'chaine', 0, '', $conf->entity); + $this->_load_tables('/takepos/sql/'); $sql = array(); diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 612a411daed..a42b68b37e4 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -44,7 +44,7 @@ class mod_payment_ant extends ModeleNumRefPayments /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Ant'; diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index cd796fbcd19..9c40a575f47 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -45,7 +45,7 @@ class mod_payment_cicada extends ModeleNumRefPayments /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Cicada'; diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index d73ee22fbae..92f86a433c8 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -47,7 +47,7 @@ class mod_project_simple extends ModeleNumRefProjects /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Simple'; diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index 9bf0d313ae8..f833ec280d2 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -44,7 +44,7 @@ class mod_project_universal extends ModeleNumRefProjects /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom = 'Universal'; diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 386de7bfdd7..8a38450697f 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -57,7 +57,7 @@ class doc_generic_task_odt extends ModelePDFTask { /** * Issuer - * @var Company object that emits + * @var Societe Object that emits */ public $emetteur; diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index 65c7deb8edf..3f9debf9941 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -47,7 +47,7 @@ class mod_task_simple extends ModeleNumRefTask /** * @var string * @deprecated - * @see name + * @see $name */ public $nom='Simple'; diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index 1eecf94734b..b1c4f576a74 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -44,7 +44,7 @@ class mod_task_universal extends ModeleNumRefTask /** * @var string * @deprecated - * @see name + * @see $name */ public $nom = 'Universal'; diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 3810ad67237..0167d900b3f 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -502,7 +502,7 @@ class pdf_azur extends ModelePDFPropales $curY = $tab_top_newpage; // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -548,7 +548,7 @@ class pdf_azur extends ModelePDFPropales // We found a page break // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -1101,28 +1101,28 @@ class pdf_azur extends ModelePDFPropales //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1133,13 +1133,13 @@ class pdf_azur extends ModelePDFPropales //Local tax 2 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('1','3','5'))) continue; + if (in_array((string) $localtax_type, array('1', '3', '5'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { - if ($tvakey!=0) // On affiche pas taux 0 + if ($tvakey != 0) // On affiche pas taux 0 { //$this->atleastoneratenotnull++; @@ -1148,15 +1148,15 @@ class pdf_azur extends ModelePDFPropales $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1192,11 +1192,11 @@ class pdf_azur extends ModelePDFPropales //Local tax 1 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ - foreach($this->localtax1 as $localtax_type => $localtax_rate) + foreach ($this->localtax1 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { if ($tvakey != 0) // On affiche pas taux 0 { @@ -1205,16 +1205,16 @@ class pdf_azur extends ModelePDFPropales $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT1", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); } @@ -1224,11 +1224,11 @@ class pdf_azur extends ModelePDFPropales //Local tax 2 after VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX2_OPTION) && $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on') //{ - foreach($this->localtax2 as $localtax_type => $localtax_rate) + foreach ($this->localtax2 as $localtax_type => $localtax_rate) { - if (in_array((string) $localtax_type, array('2','4','6'))) continue; + if (in_array((string) $localtax_type, array('2', '4', '6'))) continue; - foreach($localtax_rate as $tvakey => $tvaval) + foreach ($localtax_rate as $tvakey => $tvaval) { // retrieve global local tax if ($tvakey != 0) // On affiche pas taux 0 @@ -1238,16 +1238,16 @@ class pdf_azur extends ModelePDFPropales $index++; $pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index); - $tvacompl=''; + $tvacompl = ''; if (preg_match('/\*/', $tvakey)) { - $tvakey=str_replace('*', '', $tvakey); + $tvakey = str_replace('*', '', $tvakey); $tvacompl = " (".$outputlangs->transnoentities("NonPercuRecuperable").")"; } $totalvat = $outputlangs->transcountrynoentities("TotalLT2", $mysoc->country_code).' '; - $totalvat.=vatrate(abs($tvakey), 1).$tvacompl; - $pdf->MultiCell($col2x-$col1x, $tab2_hl, $totalvat, 0, 'L', 1); + $totalvat .= vatrate(abs($tvakey), 1).$tvacompl; + $pdf->MultiCell($col2x - $col1x, $tab2_hl, $totalvat, 0, 'L', 1); $pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index); $pdf->MultiCell($largcol2, $tab2_hl, price($tvaval, 0, $outputlangs), 0, 'R', 1); @@ -1476,7 +1476,7 @@ class pdf_azur extends ModelePDFPropales if ($this->emetteur->logo) { $logodir = $conf->mycompany->dir_output; - if (! empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; + if (!empty($conf->mycompany->multidir_output[$object->entity])) $logodir = $conf->mycompany->multidir_output[$object->entity]; if (empty($conf->global->MAIN_PDF_USE_LARGE_LOGO)) { $logo = $logodir.'/logos/thumbs/'.$this->emetteur->logo_small; @@ -1528,27 +1528,27 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 07ceb461803..cbbf462b446 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -594,7 +594,7 @@ class pdf_cyan extends ModelePDFPropales $curY = $tab_top_newpage; // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -640,7 +640,7 @@ class pdf_cyan extends ModelePDFPropales { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages - if(!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) + if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; else $showpricebeforepagebreak = 0; @@ -1588,27 +1588,27 @@ class pdf_cyan extends ModelePDFPropales $pdf->MultiCell(100, 3, $outputlangs->transnoentities("RefCustomer")." : ".$outputlangs->convToOutputCharset($object->ref_client), '', 'R'); } - if (! empty($conf->global->PDF_SHOW_PROJECT_TITLE)) + if (!empty($conf->global->PDF_SHOW_PROJECT_TITLE)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : " . (empty($object->project->title)?'':$object->projet->title), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("Project")." : ".(empty($object->project->title) ? '' : $object->projet->title), '', 'R'); } } - if (! empty($conf->global->PDF_SHOW_PROJECT)) + if (!empty($conf->global->PDF_SHOW_PROJECT)) { $object->fetch_projet(); - if (! empty($object->project->ref)) + if (!empty($object->project->ref)) { - $posy+=3; + $posy += 3; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(0, 0, 60); - $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : " . (empty($object->project->ref)?'':$object->projet->ref), '', 'R'); + $pdf->MultiCell($w, 3, $outputlangs->transnoentities("RefProject")." : ".(empty($object->project->ref) ? '' : $object->projet->ref), '', 'R'); } } diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 51438ed6bf8..89a532c2556 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php'; class doc_generic_reception_odt extends ModelePdfReception { /** - * @var Company Issuer object that emits + * @var Societe Issuer object that emits */ public $emetteur; // Objet societe qui emet diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 23609ad4384..d5ccf5dbd89 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -209,7 +209,7 @@ class doc_generic_stock_odt extends ModelePDFStock /** * Function to build a document on disk using the generic odt module. * - * @param Stock $object Object source to build document + * @param Entrepot $object Object source to build document * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details @@ -250,7 +250,7 @@ class doc_generic_stock_odt extends ModelePDFStock if (!is_object($object)) { $id = $object; - $object = new Stock($this->db); + $object = new Entrepot($this->db); $result = $object->fetch($id); if ($result < 0) { @@ -258,7 +258,8 @@ class doc_generic_stock_odt extends ModelePDFStock return -1; } } - $stockFournisseur = new StockFournisseur($this->db); + + $stockFournisseur = new ProductFournisseur($this->db); $supplierprices = $stockFournisseur->list_stock_fournisseur_price($object->id); $object->supplierprices = $supplierprices; diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index b2898c2fbac..17071641817 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -181,7 +181,7 @@ class pdf_standard extends ModelePDFStock /** * Function to build a document on disk using the generic odt module. * - * @param Stock $object Object source to build document + * @param Entrepot $object Object source to build document * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index 8708a2c01a2..7d2aafb4882 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -47,7 +47,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Cactus'; diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index 85eb6673124..39360550d8c 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -50,7 +50,7 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Tulip'; diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index ece2d8e5a7e..25fdd77991b 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -45,7 +45,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Muguet'; diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index 565e8cbd41d..72ba5f28186 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -46,7 +46,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Orchidee'; diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php index 92a2862143f..60d25792988 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php @@ -44,7 +44,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Brodator'; diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php index 1bc34d41bce..8a16475b383 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php @@ -45,7 +45,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Bronan'; diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index 9c7305d1c07..77503c4b61b 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -225,7 +225,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal /** * Function to build a document on disk using the generic odt module. * - * @param Propale $object Object source to build document + * @param Propal $object Object source to build document * @param Translate $outputlangs Lang output object * @param string $srctemplatepath Full path of source filename for generator using a template file * @param int $hidedetails Do not show line details diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php index 8fa71cc1a3b..7bd15599e24 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php @@ -47,7 +47,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Marbre'; diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php index bfaaa6b15fb..7cf4d295239 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_saphir.php @@ -47,7 +47,7 @@ class mod_supplier_proposal_saphir extends ModeleNumRefSupplierProposal /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Saphir'; diff --git a/htdocs/core/modules/ticket/mod_ticket_simple.php b/htdocs/core/modules/ticket/mod_ticket_simple.php index dbec61b67bf..3245f7b8e84 100644 --- a/htdocs/core/modules/ticket/mod_ticket_simple.php +++ b/htdocs/core/modules/ticket/mod_ticket_simple.php @@ -46,7 +46,7 @@ class mod_ticket_simple extends ModeleNumRefTicket /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Simple'; diff --git a/htdocs/core/modules/ticket/mod_ticket_universal.php b/htdocs/core/modules/ticket/mod_ticket_universal.php index 5b5f5a55953..e6749bbb1f6 100644 --- a/htdocs/core/modules/ticket/mod_ticket_universal.php +++ b/htdocs/core/modules/ticket/mod_ticket_universal.php @@ -43,7 +43,7 @@ class mod_ticket_universal extends ModeleNumRefTicket /** * @var string Nom du modele * @deprecated - * @see name + * @see $name */ public $nom='Universal'; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index f8767a82163..1ef3ef07255 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -73,7 +73,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] //print $key.'-'.$enabled.'-'.$perms.'-'.$label.$_POST["options_" . $key].'
'."\n"; if (empty($enabled)) continue; // 0 = Never visible field - if (abs($enabled) != 1 && abs($enabled) != 3) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list + if (abs($enabled) != 1 && abs($enabled) != 3 && abs($enabled) != 5) continue; // <> -1 and <> 1 and <> 3 = not visible on forms, only on list if (empty($perms)) continue; // 0 = Not visible // Load language if required @@ -135,7 +135,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] if ($object->element == 'productlot') $permok = $user->rights->stock->creer; if ($object->element == 'facturerec') $permok = $user->rights->facture->creer; if (($object->statut == 0 || !empty($extrafields->attributes[$object->table_element]['alwayseditable'][$key])) - && $permok && ($action != 'edit_extras' || GETPOST('attribute') != $key) + && $permok && $enabled != 5 && ($action != 'edit_extras' || GETPOST('attribute') != $key) && empty($extrafields->attributes[$object->table_element]['computed'][$key])) { $fieldid = 'id'; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index b60c48da09c..954a6a8b089 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -432,7 +432,7 @@ if ($nolinesbefore) { showOptionals($extrafields, 'edit', array('colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); + print $objectline->showOptionals($extrafields, 'edit', array('colspan'=>$coldisplay), '', '', 1); } if ((!empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required @@ -541,6 +541,7 @@ if (!empty($usemargins) && $user->rights->margins->creer) else if (npRate == "np_markRate") price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); } + $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formated value return true; @@ -552,26 +553,26 @@ if (!empty($usemargins) && $user->rights->margins->creer) /* JQuery for product free or predefined select */ jQuery(document).ready(function() { - jQuery("#price_ht").keyup(function(event) { - // console.log(event.which); // discard event tag and arrows - if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') { - jQuery("#price_ttc").val(''); - jQuery("#multicurrency_subprice").val(''); - } + jQuery("#price_ht").keyup(function(event) { + // console.log(event.which); // discard event tag and arrows + if (event.which != 9 && (event.which < 37 ||event.which > 40) && jQuery("#price_ht").val() != '') { + jQuery("#price_ttc").val(''); + jQuery("#multicurrency_subprice").val(''); + } }); jQuery("#price_ttc").keyup(function(event) { - // console.log(event.which); // discard event tag and arrows - if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { - jQuery("#price_ht").val(''); - jQuery("#multicurrency_subprice").val(''); - } + // console.log(event.which); // discard event tag and arrows + if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { + jQuery("#price_ht").val(''); + jQuery("#multicurrency_subprice").val(''); + } }); jQuery("#multicurrency_subprice").keyup(function(event) { - // console.log(event.which); // discard event tag and arrows - if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { - jQuery("#price_ht").val(''); - jQuery("#price_ttc").val(''); - } + // console.log(event.which); // discard event tag and arrows + if (event.which != 9 && (event.which < 37 || event.which > 40) && jQuery("#price_ttc").val() != '') { + jQuery("#price_ht").val(''); + jQuery("#price_ttc").val(''); + } }); $("#prod_entry_mode_free").on( "click", function() { @@ -630,15 +631,24 @@ if (!empty($usemargins) && $user->rights->margins->creer) if (empty($conf->global->MAIN_DISABLE_EDIT_PREDEF_PRICEHT) && empty($senderissupplier)) { ?> - // Get the HT price for the product and display it - console.log("Load price without tax and set it into #price_ht"); - $.post('/product/ajax/products.php?action=fetch', - { 'id': $(this).val(), 'socid' : socid; ?> }, - function(data) { jQuery("#price_ht").val(data.price_ht); }, - 'json' - ); + var pbq = parseInt($('option:selected', this).attr('data-pbq')); + if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0) + { + console.log("We are in a price per qty context, we do not call ajax/product"); + } else { + // Get the HT price for the product and display it + console.log("Load price without tax and set it into #price_ht for id="+$(this).val()+" socid=socid; ?>"); + $.post('/product/ajax/products.php?action=fetch', + { 'id': $(this).val(), 'socid': socid; ?> }, + function(data) { + jQuery("#price_ht").val(data.price_ht); + }, + 'json' + ); + } rights->margins->creer) { $langs->load('stocks'); @@ -744,15 +754,20 @@ if (!empty($usemargins) && $user->rights->margins->creer) } ?> - /* To process customer price per quantity */ + /* To process customer price per quantity (CUSTOMER_PRICE_PER_QTY works only if combo product is not an ajax after x key pressed) */ var pbq = parseInt($('option:selected', this).attr('data-pbq')); + var pbqup = parseInt($('option:selected', this).attr('data-pbqup')); + var pbqbase = $('option:selected', this).attr('data-pbqbase'); var pbqqty = parseFloat($('option:selected', this).attr('data-pbqqty')); var pbqpercent = parseFloat($('option:selected', this).attr('data-pbqpercent')); - if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && typeof pbq !== "undefined") + if ((jQuery('#idprod').val() > 0 || jQuery('#idprodfournprice').val()) && ! isNaN(pbq) && pbq > 0) { - console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent); + var pbqupht = pbqup; /* TODO support of price per qty TTC not yet available */ + + console.log("We choose a price by quanty price_by_qty id = "+pbq+" price_by_qty upht = "+pbqupht+" price_by_qty qty = "+pbqqty+" price_by_qty percent = "+pbqpercent); jQuery("#pbq").val(pbq); + jQuery("#price_ht").val(pbqupht); if (jQuery("#qty").val() < pbqqty) { jQuery("#qty").val(pbqqty); @@ -809,7 +824,6 @@ if (!empty($usemargins) && $user->rights->margins->creer) jQuery("#price_ht").val('').hide(); jQuery("#multicurrency_price_ht").val('').hide(); - jQuery("#price_ht").val(''); jQuery("#price_ttc, #fourn_ref, #tva_tx, #title_vat, #title_up_ht_currency, #title_up_ttc, #title_up_ttc_currency").hide(); jQuery("#np_marginRate, #np_markRate, .np_marginRate, .np_markRate, #units, #title_units").hide(); jQuery("#buying_price").show(); diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 7c76a5c0e07..278b8eabdd8 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -260,7 +260,7 @@ $coldisplay++; //Line extrafield if (!empty($extrafields)) { - print $line->showOptionals($extrafields, 'edit', array('class'=>'tredited', 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); + print $line->showOptionals($extrafields, 'edit', array('class'=>'tredited', 'colspan'=>$coldisplay), '', '', 1); } ?> diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 19a10e0f560..59f2e1ef57c 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -356,7 +356,7 @@ print "\n"; //Line extrafield if (!empty($extrafields)) { - print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); + print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"', 'colspan'=>$coldisplay), '', '', 1); } print "\n"; diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 4adef57e816..95ea92f1ff3 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -284,10 +284,10 @@ class Donations extends DolibarrApi * * @url POST {id}/validate * - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 * * @return array */ diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index e6968109bf7..0c27f710135 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -812,9 +812,9 @@ class EmailCollector extends CommonObject //var_dump($tmpproperty.' - '.$regexstring.' - '.$regexoptions.' - '.$sourcestring); if (preg_match('/'.$regexstring.'/'.$regexoptions, $sourcestring, $regforval)) { - //var_dump($regforval[1]);exit; + //var_dump($regforval[count($regforval)-1]);exit; // Overwrite param $tmpproperty - $object->$tmpproperty = isset($regforval[1]) ?trim($regforval[1]) : null; + $object->$tmpproperty = isset($regforval[count($regforval)-1]) ?trim($regforval[count($regforval)-1]) : null; } else { @@ -1423,9 +1423,9 @@ class EmailCollector extends CommonObject //var_dump($regexstring);var_dump($sourcestring); if (preg_match('/'.$regexstring.'/ms', $sourcestring, $regforval)) { - //var_dump($regforval[1]);exit; + //var_dump($regforval[count($regforval)-1]);exit; // Overwrite param $tmpproperty - $nametouseforthirdparty = isset($regforval[1]) ?trim($regforval[1]) : null; + $nametouseforthirdparty = isset($regforval[count($regforval)-1]) ?trim($regforval[count($regforval)-1]) : null; } else { diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index dde2b2f7f7b..741b0c09611 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1578,7 +1578,7 @@ if ($action == 'create') //$line->fetch_optionals($line->id); $line->array_options = array_merge($line->array_options, $srcLine->array_options); - print $expLine->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"', 'colspan'=>$colspan), $indiceAsked, '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD) ? 0 : 1); + print $expLine->showOptionals($extrafields, 'edit', array('style'=>'class="drag drop oddeven"', 'colspan'=>$colspan), $indiceAsked, '', 1); } } diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 5aca14fb28d..8526f0c9610 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -373,8 +373,9 @@ class Shipments extends DolibarrApi * @url DELETE {id}/lines/{lineid} * * @return int - * @throws 401 - * @throws 404 + * + * @throws RestException 401 + * @throws RestException 404 */ public function deleteLine($id, $lineid) { @@ -537,10 +538,10 @@ class Shipments extends DolibarrApi // * // * @return int // * - // * @throws 400 - // * @throws 401 - // * @throws 404 - // * @throws 405 + // * @throws RestException 400 + // * @throws RestException 401 + // * @throws RestException 404 + // * @throws RestException 405 // */ /* public function setinvoiced($id) @@ -574,10 +575,10 @@ class Shipments extends DolibarrApi // * @url POST /createfromorder/{orderid} // * // * @return int - // * @throws 400 - // * @throws 401 - // * @throws 404 - // * @throws 405 + // * @throws RestException 400 + // * @throws RestException 401 + // * @throws RestException 404 + // * @throws RestException 405 // */ /* public function createShipmentFromOrder($orderid) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 05272aa2ff7..14ab2b88f22 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1486,7 +1486,7 @@ class ExpenseReport extends CommonObject { // phpcs:enable $error = 0; - $this->date_cancel = $this->db->idate(gmmktime()); + $this->date_cancel = $this->db->idate(dol_now()); if ($this->fk_statut != self::STATUS_CANCELED) { $this->db->begin(); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 93d5e3339b1..3d1a23ee26d 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -353,7 +353,7 @@ if (empty($reshook)) $desc .= '
'; $desc .= ' ('.$langs->trans('Quantity').': '.$lines[$i]->qty.')'; - $timearray = dol_getdate(mktime()); + $timearray = dol_getdate(dol_now()); $date_intervention = dol_mktime(0, 0, 0, $timearray['mon'], $timearray['mday'], $timearray['year']); if ($product_type == Product::TYPE_PRODUCT) { diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 21e5e82c13b..204471bc9e7 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -194,8 +194,8 @@ class SupplierInvoices extends DolibarrApi * * @return int ID of supplier invoice * - * @throws 401 - * @throws 500 + * @throws RestException 401 + * @throws RestException 500 */ public function post($request_data = null) { @@ -226,8 +226,8 @@ class SupplierInvoices extends DolibarrApi * * @return int * - * @throws 401 - * @throws 404 + * @throws RestException 401 + * @throws RestException 404 */ public function put($id, $request_data = null) { @@ -262,9 +262,9 @@ class SupplierInvoices extends DolibarrApi * * @return array * - * @throws 401 - * @throws 404 - * @throws 500 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 500 */ public function delete($id) { @@ -304,11 +304,11 @@ class SupplierInvoices extends DolibarrApi * * @return array * - * @throws 304 - * @throws 401 - * @throws 404 - * @throws 405 - * @throws 500 + * @throws RestException 304 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 + * @throws RestException 500 */ public function validate($id, $idwarehouse = 0, $notrigger = 0) { @@ -348,10 +348,10 @@ class SupplierInvoices extends DolibarrApi * @url GET {id}/payments * * @return array - * @throws 400 - * @throws 401 - * @throws 404 - * @throws 405 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 + * @throws RestException 405 */ public function getPayments($id) { @@ -396,9 +396,9 @@ class SupplierInvoices extends DolibarrApi * @url POST {id}/payments * * @return int Payment ID - * @throws 400 - * @throws 401 - * @throws 404 + * @throws RestException 400 + * @throws RestException 401 + * @throws RestException 404 */ public function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') { diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php index 37ac4c55e9d..cb2e27b1a97 100644 --- a/htdocs/fourn/class/api_supplier_orders.class.php +++ b/htdocs/fourn/class/api_supplier_orders.class.php @@ -252,8 +252,8 @@ class SupplierOrders extends DolibarrApi /** * Delete supplier order * - * @param int $id Supplier order ID - * @return type + * @param int $id Supplier order ID + * @return array Array of result */ public function delete($id) { diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 6ca038a8a3d..bed02b94d55 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -185,7 +185,7 @@ class CommandeFournisseur extends CommonOrder - public $fields=array( + public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>15), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>20), @@ -455,11 +455,11 @@ class CommandeFournisseur extends CommonOrder $sql .= " l.date_start, l.date_end,"; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc'; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) - $sql.= ", pfp.rowid as fk_pfp, pfp.packaging"; + $sql .= ", pfp.rowid as fk_pfp, pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l"; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid'; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON l.fk_product = pfp.fk_product and l.ref = pfp.ref_fourn"; $sql .= " WHERE l.fk_commande = ".$this->id; if ($only_product) $sql .= ' AND p.fk_product_type = 0'; $sql .= " ORDER BY l.rang, l.rowid"; @@ -516,7 +516,7 @@ class CommandeFournisseur extends CommonOrder $line->packaging = $objp->packaging; } - $line->date_start = $this->db->jdate($objp->date_start); + $line->date_start = $this->db->jdate($objp->date_start); $line->date_end = $this->db->jdate($objp->date_end); $line->fk_unit = $objp->fk_unit; @@ -1701,7 +1701,7 @@ class CommandeFournisseur extends CommonOrder if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) { $prod = new Product($this->db, $fk_product); - $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc?$this->fk_soc:$this->socid)); + $prod->get_buyprice($fk_prod_fourn_price, $qty, $fk_product, 'none', ($this->fk_soc ? $this->fk_soc : $this->socid)); if ($qty < $prod->packaging) { $qty = $prod->packaging; @@ -1710,7 +1710,7 @@ class CommandeFournisseur extends CommonOrder { if (($qty % $prod->packaging) > 0) { - $coeff = intval($qty/$prod->packaging) + 1; + $coeff = intval($qty / $prod->packaging) + 1; $qty = $prod->packaging * $coeff; setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); } @@ -2679,7 +2679,7 @@ class CommandeFournisseur extends CommonOrder { if (($qty % $this->line->packaging) > 0) { - $coeff = intval($qty/$this->line->packaging) + 1; + $coeff = intval($qty / $this->line->packaging) + 1; $qty = $this->line->packaging * $coeff; setEventMessage($langs->trans('QtyRecalculatedWithPackaging'), 'mesgs'); } @@ -3451,11 +3451,11 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql .= ' cd.date_start, cd.date_end, cd.fk_unit,'; $sql .= ' cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc'; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) - $sql.= ", pfp.rowid as fk_pfp, pfp.packaging"; + $sql .= ", pfp.rowid as fk_pfp, pfp.packaging"; $sql .= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON cd.fk_product = pfp.fk_product and cd.ref = pfp.ref_fourn"; $sql .= ' WHERE cd.rowid = '.$rowid; $result = $this->db->query($sql); if ($result) diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index a0cf142a23b..6178bc5ae3c 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -218,7 +218,7 @@ class FactureFournisseur extends CommonInvoice public $fk_facture_source; - public $fields=array( + public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), 'ref' =>array('type'=>'varchar(255)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>15), 'ref_supplier' =>array('type'=>'varchar(255)', 'label'=>'RefSupplier', 'enabled'=>1, 'visible'=>-1, 'position'=>20), @@ -2287,7 +2287,7 @@ class FactureFournisseur extends CommonInvoice if ($facturestatic->hasDelay()) { $response->nbtodolate++; - $response->url_late=DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills'; + $response->url_late = DOL_URL_ROOT.'/fourn/facture/list.php?option=late&mainmenu=billing&leftmenu=suppliers_bills'; } } $this->db->free($resql); diff --git a/htdocs/fourn/class/fournisseur.product.class.php b/htdocs/fourn/class/fournisseur.product.class.php index 6c139d73707..332e33ece59 100644 --- a/htdocs/fourn/class/fournisseur.product.class.php +++ b/htdocs/fourn/class/fournisseur.product.class.php @@ -360,7 +360,7 @@ class ProductFournisseur extends Product $sql .= " supplier_reputation = ".(empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").","; $sql .= " barcode = ".(empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").","; $sql .= " fk_barcode_type = ".(empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'"); - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", packaging = ".(empty($packaging) ? 1 : $packaging); + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", packaging = ".(empty($packaging) ? 1 : $packaging); $sql .= " WHERE rowid = ".$this->product_fourn_price_id; // TODO Add price_base_type and price_ttc @@ -410,7 +410,7 @@ class ProductFournisseur extends Product $sql = "INSERT INTO ".MAIN_DB_PREFIX."product_fournisseur_price("; $sql .= " multicurrency_price, multicurrency_unitprice, multicurrency_tx, fk_multicurrency, multicurrency_code,"; $sql .= "datec, fk_product, fk_soc, ref_fourn, desc_fourn, fk_user, price, quantity, remise_percent, remise, unitprice, tva_tx, charges, fk_availability, default_vat_code, info_bits, entity, delivery_time_days, supplier_reputation, barcode, fk_barcode_type)"; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", packaging"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", packaging"; $sql .= " values("; $sql .= (isset($multicurrency_buyprice) ? "'".$this->db->escape(price2num($multicurrency_buyprice))."'" : 'null').","; $sql .= (isset($multicurrency_unitBuyPrice) ? "'".$this->db->escape(price2num($multicurrency_unitBuyPrice))."'" : 'null').","; @@ -438,14 +438,14 @@ class ProductFournisseur extends Product $sql .= (empty($supplier_reputation) ? 'NULL' : "'".$this->db->escape($supplier_reputation)."'").","; $sql .= (empty($barcode) ? 'NULL' : "'".$this->db->escape($barcode)."'").","; $sql .= (empty($fk_barcode_type) ? 'NULL' : "'".$this->db->escape($fk_barcode_type)."'"); - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", ".(empty($this->packaging) ? 1 : $this->db->escape($this->packaging)) ; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", ".(empty($this->packaging) ? 1 : $this->db->escape($this->packaging)); $sql .= ")"; $this->product_fourn_price_id = 0; $resql = $this->db->query($sql); if ($resql) { - $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX . "product_fournisseur_price"); + $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price"); } else { $error++; @@ -505,7 +505,7 @@ class ProductFournisseur extends Product $sql .= " pfp.supplier_reputation, pfp.fk_user, pfp.datec,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code,"; $sql .= " pfp.barcode, pfp.fk_barcode_type"; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp"; $sql .= " WHERE pfp.rowid = ".(int) $rowid; @@ -609,7 +609,7 @@ class ProductFournisseur extends Product $sql .= " pfp.price, pfp.quantity, pfp.unitprice, pfp.remise_percent, pfp.remise, pfp.tva_tx, pfp.fk_availability, pfp.charges, pfp.info_bits, pfp.delivery_time_days, pfp.supplier_reputation,"; $sql .= " pfp.multicurrency_price, pfp.multicurrency_unitprice, pfp.multicurrency_tx, pfp.fk_multicurrency, pfp.multicurrency_code, pfp.datec, pfp.tms,"; $sql .= " pfp.barcode, pfp.fk_barcode_type"; - if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql.= ", pfp.packaging"; + if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $sql .= ", pfp.packaging"; $sql .= " FROM ".MAIN_DB_PREFIX."product_fournisseur_price as pfp, ".MAIN_DB_PREFIX."societe as s"; $sql .= " WHERE pfp.entity IN (".getEntity('productsupplierprice').")"; $sql .= " AND pfp.fk_soc = s.rowid"; diff --git a/htdocs/fourn/commande/index.php b/htdocs/fourn/commande/index.php index b6720a93e57..45abd70e0be 100644 --- a/htdocs/fourn/commande/index.php +++ b/htdocs/fourn/commande/index.php @@ -166,7 +166,7 @@ $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."commande_fournisseur as cf"; if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= " WHERE cf.fk_soc = s.rowid"; -$sql.= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing +$sql .= " AND cf.entity IN (".getEntity("supplier_order").")"; // Thirdparty sharing is mandatory with supplier order sharing if ($user->socid) $sql .= ' AND cf.fk_soc = '.$user->socid; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; $sql .= " GROUP BY cf.fk_statut"; @@ -253,23 +253,23 @@ if (!empty($conf->fournisseur->enabled)) */ $sql = "SELECT"; -if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { +if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $sql .= " DISTINCT"; } -$sql.= " u.rowid, u.lastname, u.firstname, u.email, u.statut"; -$sql.= " FROM ".MAIN_DB_PREFIX."user as u"; -if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) +$sql .= " u.rowid, u.lastname, u.firstname, u.email, u.statut"; +$sql .= " FROM ".MAIN_DB_PREFIX."user as u"; +if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { - $sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug"; - $sql.= " WHERE ((ug.fk_user = u.rowid"; - $sql.= " AND ug.entity IN (".getEntity('usergroup')."))"; - $sql.= " OR u.entity = 0)"; // Show always superadmin + $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; + $sql .= " WHERE ((ug.fk_user = u.rowid"; + $sql .= " AND ug.entity IN (".getEntity('usergroup')."))"; + $sql .= " OR u.entity = 0)"; // Show always superadmin } else { - $sql.= " WHERE (u.entity IN (".getEntity('user').")"; + $sql .= " WHERE (u.entity IN (".getEntity('user').")"; } -$sql.= " AND u.fk_soc IS NULL"; // An external user can not approved +$sql .= " AND u.fk_soc IS NULL"; // An external user can not approved $resql = $db->query($sql); if ($resql) @@ -290,7 +290,7 @@ if ($resql) $userstatic->id = $obj->rowid; $userstatic->getrights('fournisseur'); - if (! empty($userstatic->rights->fournisseur->commande->approuver)) + if (!empty($userstatic->rights->fournisseur->commande->approuver)) { print ''; print '
'; - print $langs->trans("Category") . ': ' . $formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true); + print $langs->trans("Category").': '.$formother->select_categories(Categorie::TYPE_PRODUCT, $selected_cat, 'search_categ', true); print ' '; - print $langs->trans("SubCats") . '? '; + print $langs->trans("SubCats").'? '; print ''; // type filter (produit/service) print ' '; - print $langs->trans("Type"). ': '; - $form->select_type_of_lines(isset($selected_type)?$selected_type:-1, 'search_type', 1, 1, 1); + print $langs->trans("Type").': '; + $form->select_type_of_lines(isset($selected_type) ? $selected_type : -1, 'search_type', 1, 1, 1); //select thirdparty print '
'; - print $langs->trans("ThirdParty") . ': ' . $form->select_thirdparty_list($selected_soc, 'search_soc', '', 1); + print $langs->trans("ThirdParty").': '.$form->select_thirdparty_list($selected_soc, 'search_soc', '', 1); print '
'; @@ -391,16 +391,16 @@ if ($modecompta == 'CREANCES-DETTES') print "
"; - $fullname=$name[$key]; + $fullname = $name[$key]; if ($key > 0) { - $linkname=''.img_object($langs->trans("ShowProduct"), $type[$key]==0?'product':'service').' '.$fullname.''; + $linkname = ''.img_object($langs->trans("ShowProduct"), $type[$key] == 0 ? 'product' : 'service').' '.$fullname.''; } else { - $linkname=$langs->trans("PaymentsNotLinkedToProduct"); + $linkname = $langs->trans("PaymentsNotLinkedToProduct"); } print $linkname; print "".dol_print_date(dol_mktime(12,0,0,$mois,1,2000),"%B")."
'; - print $formcompany->select_civility(GETPOSTISSET("civility_code") ?GETPOST("civility_code", 'alpha') : $object->civility_code, 'civility_code'); + print $formcompany->select_civility(GETPOSTISSET("civility_code") ? GETPOST("civility_code", 'alpha') : $object->civility_code, 'civility_code'); print '
/ '; - print $formcompany->select_ziptown((GETPOST("zipcode", 'alpha') ?GETPOST("zipcode", 'alpha') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6).' '; - print $formcompany->select_ziptown((GETPOST("town", 'alpha') ?GETPOST("town", 'alpha') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); + print $formcompany->select_ziptown((GETPOST("zipcode", 'alpha') ? GETPOST("zipcode", 'alpha') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6).' '; + print $formcompany->select_ziptown((GETPOST("town", 'alpha') ? GETPOST("town", 'alpha') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); print '
'; - print $form->select_country((GETPOST("country_id", 'alpha') ?GETPOST("country_id", 'alpha') : $object->country_id), 'country_id'); + print $form->select_country((GETPOST("country_id", 'alpha') ? GETPOST("country_id", 'alpha') : $object->country_id), 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '
'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePro', 'phone_pro', '', $object, 0).'
'.img_picto('', 'object_phoning').' '.$form->editfieldkey('PhonePerso', 'phone_perso', '', $object, 0).'
'.img_picto('', 'object_phoning_mobile').' '.$form->editfieldkey('PhoneMobile', 'phone_mobile', '', $object, 0).'
'.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', '', $object, 0).'
'.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '').'
'.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ?GETPOST("no_email", 'alpha') : $noemail), 1).''.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'alpha') : $noemail), 1).'
getLibStatut(7); ?>'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
'; + print ''.img_object('', 'mrp').' '.$langs->trans("MO").''; + print ''; + print $product->stats_mo['suppliers']; + print ''; + print $product->stats_mo['nb']; + print ''; + print $product->stats_mo['qty']; + print '
'; + print ''; print $projectstatic->getNomUrl(1, '', 0, ''.$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project]); if ($thirdpartystatic->id > 0) print ' - '.$thirdpartystatic->getNomUrl(1); if ($projectstatic->title) @@ -1840,11 +1840,11 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & // Ref print ''; print ''; - for ($k = 0 ; $k < $level ; $k++) print "   "; + for ($k = 0; $k < $level; $k++) print "   "; print $taskstatic->getNomUrl(1, 'withproject', 'time'); // Label task print '
'; - for ($k = 0 ; $k < $level ; $k++) print "   "; + for ($k = 0; $k < $level; $k++) print "   "; //print $taskstatic->getNomUrl(0, 'withproject', 'time'); print $taskstatic->label; //print "
"; @@ -1860,7 +1860,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & // Progress declared % print '
'; - print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress'); + print $formother->select_percent($lines[$i]->progress, $lines[$i]->id.'progress'); print ''; - $tmptimespent=$taskstatic->getSummaryOfTimeSpent($fuser->id); + $tmptimespent = $taskstatic->getSummaryOfTimeSpent($fuser->id); if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'], 'allhourmin'); else print '--:--'; print "'; - $placeholder=''; + $tableCell = ''; + $placeholder = ''; if ($alreadyspent) { - $tableCell.=''; + $tableCell .= ''; //$placeholder=' placeholder="00:00"'; //$tableCell.='+'; } - $tableCell.=''; - $tableCell.=''; - if ((! $lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject")); + if ((!$lines[$i]->public) && $disabledproject) print $form->textwithpicto('', $langs->trans("UserIsNotContactOfProject")); elseif ($disabledtask) { $titleassigntask = $langs->trans("AssignTaskToMe"); @@ -1959,9 +1959,9 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & $ret = projectLinesPerMonth($inc, $firstdaytoshow, $fuser, $lines[$i]->id, ($parent == 0 ? $lineswithoutlevel0 : $lines), $level, $projectsrole, $tasksrole, $mine, $restricteditformytask, $isavailable, $oldprojectforbreak, $TWeek); //var_dump('ret with parent='.$lines[$i]->id.' level='.$level); //var_dump($ret); - foreach($ret as $key => $val) + foreach ($ret as $key => $val) { - $totalforeachweek[$key]+=$val; + $totalforeachweek[$key] += $val; } //var_dump('totalforeachday after taskid='.$lines[$i]->id.' and previous one on level '.$level.' + subtasks'); //var_dump($totalforeachday); @@ -2147,16 +2147,17 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print_liste_field_titre("ThirdParty", $_SERVER["PHP_SELF"], "", "", "", "", $sortfield, $sortorder); if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) { + if (!in_array('prospectionstatus', $hiddenfields)) print_liste_field_titre("OpportunityStatus", "", "", "", "", '', $sortfield, $sortorder, 'right '); print_liste_field_titre("OpportunityAmount", "", "", "", "", 'align="right"', $sortfield, $sortorder); print_liste_field_titre('OpportunityWeightedAmount', '', '', '', '', 'align="right"', $sortfield, $sortorder); } if (empty($conf->global->PROJECT_HIDE_TASKS)) { print_liste_field_titre("Tasks", "", "", "", "", 'align="right"', $sortfield, $sortorder); - if (!in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", 'align="right"', $sortfield, $sortorder); - if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", 'align="right"', $sortfield, $sortorder); + if (!in_array('plannedworkload', $hiddenfields)) print_liste_field_titre("PlannedWorkload", "", "", "", "", '', $sortfield, $sortorder, 'right '); + if (!in_array('declaredprogress', $hiddenfields)) print_liste_field_titre("ProgressDeclared", "", "", "", "", '', $sortfield, $sortorder, 'right '); } - print_liste_field_titre("Status", "", "", "", "", 'align="right"', $sortfield, $sortorder); + if (!in_array('projectstatus', $hiddenfields)) print_liste_field_titre("Status", "", "", "", "", '', $sortfield, $sortorder, 'right '); print "
'; print $projectstatic->getNomUrl(1); if (!in_array('projectlabel', $hiddenfields)) print '
'.dol_trunc($objp->title, 24); @@ -2194,8 +2195,35 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks print $thirdpartystatic->getNomUrl(1); } print '
'; + // Because color of prospection status has no meaning yet, it is used if hidden constant is set + if (empty($conf->global->USE_COLOR_FOR_PROSPECTION_STATUS)) { + if ($langs->trans("OppStatus".$oppStatusCode) != "OppStatus".$oppStatusCode) { + print $langs->trans("OppStatus".$oppStatusCode); + } + } else { + if (isset($statusOppList[$objp->opp_status])) { + $oppStatusCode = $statusOppList[$objp->opp_status]['code']; + $oppStatusColor = $statusOppList[$objp->opp_status]['color']; + } else { + $oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); + $oppStatusColor = ''; + } + if ($oppStatusCode) { + if (!empty($oppStatusColor)) { + print ''; + } else { + print ''.$oppStatusCode.''; + } + } + } + print ''; if ($objp->opp_amount) print price($objp->opp_amount, 0, '', 1, -1, -1, $conf->currency); print ''.$objp->nb.''; - //print $projectstatic->getLibStatut(3); - if (isset($statusOppList[$objp->opp_status])) { - $oppStatusCode = $statusOppList[$objp->opp_status]['code']; - $oppStatusColor = $statusOppList[$objp->opp_status]['color']; - } else { - $oppStatusCode = dol_getIdFromCode($db, $objp->opp_status, 'c_lead_status', 'rowid', 'code'); - $oppStatusColor = ''; + if (!in_array('projectstatus', $hiddenfields)) { + print ''; + print $projectstatic->getLibStatut(3); + print '
'.$langs->trans("Total")."'.price($total_opp_amount, 0, '', 1, -1, -1, $conf->currency).''.$form->textwithpicto(price($ponderated_opp_amount, 0, '', 1, -1, -1, $conf->currency), $langs->trans("OpportunityPonderatedAmountDesc"), 1).''.($total_plannedworkload ?convertSecondToTime($total_plannedworkload) : '').''.($total_plannedworkload ?round(100 * $total_declaredprogressworkload / $total_plannedworkload, 0).'%' : '').'
Remise d\'espèces Chèque Virement, prélèvement, carte bancaire Remise d\'espèces Chèque Virement, prélèvement, carte bancaire Remise d\'espèces Chèque Virement, prélèvement, carte bancaire
'; diff --git a/htdocs/fourn/facture/paiement.php b/htdocs/fourn/facture/paiement.php index e0a679d1321..1b6f8257977 100644 --- a/htdocs/fourn/facture/paiement.php +++ b/htdocs/fourn/facture/paiement.php @@ -297,9 +297,13 @@ if (empty($reshook)) $paiement->datepaye = $datepaye; $paiement->amounts = $amounts; // Array of amounts $paiement->multicurrency_amounts = $multicurrency_amounts; - $paiement->paiementid = $_POST['paiementid']; - $paiement->num_paiement = $_POST['num_paiement']; - $paiement->note = $_POST['comment']; + $paiement->paiementid = GETPOST('paiementid', 'int'); + + $paiement->num_payment = GETPOST('num_paiement', 'alpha'); + $paiement->note_private = GETPOST('comment', 'alpha'); + $paiement->num_paiement = $paiement->num_payment; // For bacward compatibility + $paiement->note = $paiement->note_private; // For bacward compatibility + if (!$error) { $paiement_id = $paiement->create($user, (GETPOST('closepaidinvoices') == 'on' ? 1 : 0), $thirdparty); diff --git a/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php b/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php index eff8bb61f29..d8445fdc70c 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/AutoLoader.php @@ -263,13 +263,7 @@ class AutoLoader * @return bool false unless className now exists */ private function loadLastResort($className, $loader = null) { - // @CHANGE LDR Add protection to avoid conflict with other autoloader - /*print 'Try to load '.$className."\n"; - if (in_array($className, array('Google_Client'))) - { - return false; - }*/ - $loaders = array_unique(static::$rogueLoaders); + $loaders = array_unique(static::$rogueLoaders); if (isset($loader)) { if (false === array_search($loader, $loaders)) static::$rogueLoaders[] = $loader; diff --git a/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php b/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php index e8248a385fa..2815f1f6c70 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/CommentParser.php @@ -159,7 +159,7 @@ class CommentParser $addNewline = true; } continue; - } elseif ($line{0} == '@') { + } elseif ($line[0] == '@') { $mode = 2; $newParam = true; } @@ -353,7 +353,7 @@ class CommentParser $data = $format->decode($str); } } else { // auto detect - if ($str{0} == '{') { + if ($str[0] == '{') { $d = json_decode($str, true); if (json_last_error() != JSON_ERROR_NONE) { throw new Exception('Error parsing embedded JSON data' @@ -445,7 +445,7 @@ class CommentParser { $r = array(); $email = end($value); - if ($email{0} == '<') { + if ($email[0] == '<') { $email = substr($email, 1, -1); array_pop($value); $r['email'] = $email; @@ -470,7 +470,7 @@ class CommentParser $data = array_shift($value); if (empty($data)) { $r['type'] = 'mixed'; - } elseif ($data{0} == '$') { + } elseif ($data[0] == '$') { $r['name'] = substr($data, 1); $r['type'] = 'mixed'; } else { @@ -478,7 +478,7 @@ class CommentParser $r['type'] = count($data) == 1 ? $data[0] : $data; $data = array_shift($value); - if (!empty($data) && $data{0} == '$') { + if (!empty($data) && $data[0] == '$') { $r['name'] = substr($data, 1); } } @@ -498,7 +498,7 @@ class CommentParser $data = array_shift($value); if (empty($data)) { $r['type'] = 'mixed'; - } elseif ($data{0} == '$') { + } elseif ($data[0] == '$') { $r['name'] = substr($data, 1); $r['type'] = 'mixed'; } else { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Format/XmlFormat.php b/htdocs/includes/restler/framework/Luracast/Restler/Format/XmlFormat.php index b51fa707a53..ceec32e4cb5 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Format/XmlFormat.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Format/XmlFormat.php @@ -221,7 +221,7 @@ class XmlFormat extends Format $namespaces = $xml->getNamespaces(); if (count($namespaces)) { $p = strpos($data, $xml->getName()); - if ($p && $data{$p - 1} == ':') { + if ($p && $data[$p - 1] == ':') { $s = strpos($data, '<') + 1; $prefix = substr($data, $s, $p - $s - 1); static::$namespacedProperties[static::$rootName] = $prefix; diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Resources.php b/htdocs/includes/restler/framework/Luracast/Restler/Resources.php index 43e95fa02be..2986968a990 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Resources.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Resources.php @@ -198,7 +198,7 @@ class Resources implements iUseAuthentication, iProvideMultiVersionApi } elseif (false !== ($pos = strpos($id, '-v'))) { //$version = intval(substr($id, $pos + 2)); $id = substr($id, 0, $pos); - } elseif ($id{0} == 'v' && is_numeric($v = substr($id, 1))) { + } elseif ($id[0] == 'v' && is_numeric($v = substr($id, 1))) { $id = ''; //$version = $v; } elseif ($id == 'root' || $id == 'index') { @@ -233,7 +233,7 @@ class Resources implements iUseAuthentication, iProvideMultiVersionApi if ($tSlash) { if ($fLen != $tLen && !Text::beginsWith($fullPath, $target . '/')) continue; - } elseif ($fLen > $tLen + 1 && $fullPath{$tLen + 1} != '{' && !Text::beginsWith($fullPath, '{')) { + } elseif ($fLen > $tLen + 1 && $fullPath[$tLen + 1] != '{' && !Text::beginsWith($fullPath, '{')) { //when mapped to root exclude paths that have static parts //they are listed else where under that static part name continue; @@ -275,7 +275,7 @@ class Resources implements iUseAuthentication, iProvideMultiVersionApi if (count($parts) == 1 && $httpMethod == 'GET') { } else { for ($i = 0; $i < count($parts); $i++) { - if (strlen($parts[$i]) && $parts[$i]{0} == '{') { + if (strlen($parts[$i]) && $parts[$i][0] == '{') { $pos = $i - 1; break; } diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Restler.php b/htdocs/includes/restler/framework/Luracast/Restler/Restler.php index c2e9b1acb73..fcb5388726c 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Restler.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Restler.php @@ -533,7 +533,7 @@ class Restler extends EventDispatcher rtrim($path, '/') //remove trailing slash if found ); - if (Defaults::$useUrlBasedVersioning && strlen($path) && $path{0} == 'v') { + if (Defaults::$useUrlBasedVersioning && strlen($path) && $path[0] == 'v') { $version = intval(substr($path, 1)); if ($version && $version <= $this->apiVersion) { $this->requestedApiVersion = $version; @@ -1599,7 +1599,7 @@ class Restler extends EventDispatcher */ public function __get($name) { - if ($name{0} == '_') { + if ($name[0] == '_') { $hiddenProperty = substr($name, 1); if (isset($this->$hiddenProperty)) { return $this->$hiddenProperty; diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Routes.php b/htdocs/includes/restler/framework/Luracast/Restler/Routes.php index 73e78dc0039..999094dec4c 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Routes.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Routes.php @@ -87,7 +87,7 @@ class Routes foreach ($methods as $method) { $methodUrl = strtolower($method->getName()); //method name should not begin with _ - if ($methodUrl{0} == '_') { + if ($methodUrl[0] == '_') { continue; } $doc = $method->getDocComment(); @@ -330,7 +330,7 @@ class Routes if (!$type) { return 's'; } - switch ($type{0}) { + switch ($type[0]) { case 'i': case 'f': return 'n'; @@ -428,7 +428,7 @@ class Routes } $index = intval(substr($k, 1)); $details = $value[$httpMethod]['metadata']['param'][$index]; - if ($k{0} == 's' || strpos($k, static::pathVarTypeOf($v)) === 0) { + if ($k[0] == 's' || strpos($k, static::pathVarTypeOf($v)) === 0) { //remove the newlines $data[$details['name']] = trim($v, PHP_EOL); } else { diff --git a/htdocs/includes/restler/framework/Luracast/Restler/Scope.php b/htdocs/includes/restler/framework/Luracast/Restler/Scope.php index 251262017c3..16ccdd33561 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/Scope.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/Scope.php @@ -203,7 +203,7 @@ class Scope $divider = '\\'; $qualified = false; - if ($className{0} == $divider) { + if ($className[0] == $divider) { $qualified = trim($className, $divider); } elseif (array_key_exists($className, $scope)) { $qualified = $scope[$className]; diff --git a/htdocs/includes/restler/framework/Luracast/Restler/UI/Emmet.php b/htdocs/includes/restler/framework/Luracast/Restler/UI/Emmet.php index abd4a3a73ba..435804b4469 100644 --- a/htdocs/includes/restler/framework/Luracast/Restler/UI/Emmet.php +++ b/htdocs/includes/restler/framework/Luracast/Restler/UI/Emmet.php @@ -356,7 +356,7 @@ class Emmet $pos = strpos($string, $f, $start); $tokens = array(); for ($i = $start; $i < $pos; $i++) { - $token = $string{$i}; + $token = $string[$i]; if (('#' == $token || '.' == $token) && (!empty($tokens) || $i == 0) ) { @@ -368,7 +368,7 @@ class Emmet $r[] = $f; } while (false != ($f = strtok(static::DELIMITERS))); for ($i = $pos; $i < strlen($string); $i++) { - $token = $string{$i}; + $token = $string[$i]; $r[] = $tokens[] = $token; } return $r; diff --git a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql index bf641871be9..0bd8acc3e3e 100644 --- a/htdocs/install/mysql/migration/11.0.0-12.0.0.sql +++ b/htdocs/install/mysql/migration/11.0.0-12.0.0.sql @@ -44,6 +44,22 @@ ALTER TABLE llx_commande_fournisseur_dispatch_extrafields ADD INDEX idx_commande -- For v12 +UPDATE llx_website SET lang = 'en' WHERE lang like 'en_%'; +UPDATE llx_website SET lang = 'fr' WHERE lang like 'fr_%'; +UPDATE llx_website SET lang = 'es' WHERE lang like 'es_%'; +UPDATE llx_website SET lang = 'de' WHERE lang like 'de_%'; +UPDATE llx_website SET lang = 'it' WHERE lang like 'it_%'; +UPDATE llx_website SET lang = 'pt' WHERE lang like 'pt_%'; +UPDATE llx_website_page SET lang = 'en' WHERE lang like 'en_%'; +UPDATE llx_website_page SET lang = 'fr' WHERE lang like 'fr_%'; +UPDATE llx_website_page SET lang = 'es' WHERE lang like 'es_%'; +UPDATE llx_website_page SET lang = 'de' WHERE lang like 'de_%'; +UPDATE llx_website_page SET lang = 'it' WHERE lang like 'it_%'; +UPDATE llx_website_page SET lang = 'pt' WHERE lang like 'pt_%'; + +ALTER TABLE llx_website ADD COLUMN lang varchar(8); +ALTER TABLE llx_website ADD COLUMN otherlang varchar(255); + ALTER TABLE llx_holiday_users DROP INDEX uk_holiday_users; ALTER TABLE llx_holiday_users ADD UNIQUE INDEX uk_holiday_users(fk_user, fk_type); diff --git a/htdocs/install/mysql/tables/llx_website.sql b/htdocs/install/mysql/tables/llx_website.sql index 645343544a4..743d4ec9ca8 100644 --- a/htdocs/install/mysql/tables/llx_website.sql +++ b/htdocs/install/mysql/tables/llx_website.sql @@ -26,6 +26,8 @@ CREATE TABLE llx_website description varchar(255), maincolor varchar(16), maincolorbis varchar(16), + lang varchar(8), + otherlang varchar(255), status integer DEFAULT 1, fk_default_home integer, use_manifest integer, diff --git a/htdocs/langs/en_US/cashdesk.lang b/htdocs/langs/en_US/cashdesk.lang index 9ba2a068478..28e87394089 100644 --- a/htdocs/langs/en_US/cashdesk.lang +++ b/htdocs/langs/en_US/cashdesk.lang @@ -84,3 +84,9 @@ SupplementCategory=Supplement category ColorTheme=Color theme Colorful=Colorful HeadBar=Head Bar +SortProductField=Field for sorting products +Browser=Browser +BrowserMethodDescription=Simple and easy receipt printing. Only a few parameters to configure the receipt. Print via browser. +TakeposConnectorMethodDescription=External module with extra features. Posibility to print from de cloud. +PrintMethod=Print method +ReceiptPrinterMethodDescription=Powerful method with a lot of parameters. Full customizable with templates. Cannot print from the cloud. \ No newline at end of file diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 7207bbacc38..1ec9b5bd409 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -78,6 +78,7 @@ CatMemberList=List of members tags/categories CatContactList=List of contact tags/categories CatSupLinks=Links between suppliers and tags/categories CatCusLinks=Links between customers/prospects and tags/categories +CatContactsLinks=Links between contacts/addresses and tags/categories CatProdLinks=Links between products/services and tags/categories CatProJectLinks=Links between projects and tags/categories DeleteFromCat=Remove from tags/category diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 525131b2a61..cc56503c638 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -228,6 +228,8 @@ ErrorFieldRequiredForProduct=Field '%s' is required for product %s ProblemIsInSetupOfTerminal=Problem is in setup of terminal %s. ErrorAddAtLeastOneLineFirst=Add at least one line first ErrorRecordAlreadyInAccountingDeletionNotPossible=Error, record is already transferred in accounting, deletion is not possible. +ErrorLanguageMandatoryIfPageSetAsTranslationOfAnother=Error, language is mandatory if you set the page as a translation of another one. +ErrorLanguageOfTranslatedPageIsSameThanThisPage=Error, language of translated page is same than this one. # Warnings WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup. WarningPasswordSetWithNoAccount=A password was set for this member. However, no user account was created. So this password is stored but can't be used to login to Dolibarr. It may be used by an external module/interface but if you don't need to define any login nor password for a member, you can disable option "Manage a login for each member" from Member module setup. If you need to manage a login but don't need any password, you can keep this field empty to avoid this warning. Note: Email can also be used as a login if the member is linked to a user. diff --git a/htdocs/langs/en_US/languages.lang b/htdocs/langs/en_US/languages.lang index 99c9b6486e0..6185183161b 100644 --- a/htdocs/langs/en_US/languages.lang +++ b/htdocs/langs/en_US/languages.lang @@ -65,7 +65,7 @@ Language_mk_MK=Macedonian Language_mn_MN=Mongolian Language_nb_NO=Norwegian (Bokmål) Language_nl_BE=Dutch (Belgium) -Language_nl_NL=Dutch (Netherlands) +Language_nl_NL=Dutch Language_pl_PL=Polish Language_pt_BR=Portuguese (Brazil) Language_pt_PT=Portuguese diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 9b96d5bef54..4f3545ae43a 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -367,7 +367,7 @@ UsePercentageVariations=Use percentage variations PercentageVariation=Percentage variation ErrorDeletingGeneratedProducts=There was an error while trying to delete existing product variants NbOfDifferentValues=No. of different values -NbProducts=No. of products +NbProducts=Number of products ParentProduct=Parent product HideChildProducts=Hide variant products ShowChildProducts=Show variant products @@ -380,3 +380,4 @@ ErrorProductCombinationNotFound=Product variant not found ActionAvailableOnVariantProductOnly=Action only available on the variant of product ProductsPricePerCustomer=Product prices per customers ProductSupplierExtraFields=Additional Attributes (Supplier Prices) +DeleteLinkedProduct=Delete the child product linked to the combination \ No newline at end of file diff --git a/htdocs/langs/en_US/projects.lang b/htdocs/langs/en_US/projects.lang index d2fd807a706..d8d113941db 100644 --- a/htdocs/langs/en_US/projects.lang +++ b/htdocs/langs/en_US/projects.lang @@ -39,8 +39,8 @@ ShowProject=Show project ShowTask=Show task SetProject=Set project NoProject=No project defined or owned -NbOfProjects=No. of projects -NbOfTasks=No. of tasks +NbOfProjects=Number of projects +NbOfTasks=Number of tasks TimeSpent=Time spent TimeSpentByYou=Time spent by you TimeSpentByUser=Time spent by user diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 1d31a763523..ee46c9f4954 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -121,3 +121,6 @@ BackToHomePage=Back to home page... TranslationLinks=Translation links YouTryToAccessToAFileThatIsNotAWebsitePage=You try to access to a page that is not a website page UseTextBetween5And70Chars=For good SEO practices, use a text between 5 and 70 characters +MainLanguage=Main language +OtherLanguages=Other languages +UseManifest=Provide a manifest.json file \ No newline at end of file diff --git a/htdocs/langs/fr_FR/cashdesk.lang b/htdocs/langs/fr_FR/cashdesk.lang index e60bf6e4777..d14acc778df 100644 --- a/htdocs/langs/fr_FR/cashdesk.lang +++ b/htdocs/langs/fr_FR/cashdesk.lang @@ -81,3 +81,4 @@ CustomReceipt=Reçu personnalisé ReceiptName=Nom du reçu ProductSupplements=Suppléments de produit SupplementCategory=Catégorie des suppléments +SortProductField=Champ pour le tri des produits diff --git a/htdocs/langs/fr_FR/products.lang b/htdocs/langs/fr_FR/products.lang index ad22750d1fe..d88b6cab7b9 100644 --- a/htdocs/langs/fr_FR/products.lang +++ b/htdocs/langs/fr_FR/products.lang @@ -375,4 +375,4 @@ ErrorDestinationProductNotFound=Produit destination non trouvé ErrorProductCombinationNotFound=Variante du produit non trouvé ActionAvailableOnVariantProductOnly=Action disponible uniquement sur la variante du produit ProductsPricePerCustomer=Prix produit par clients -ProductSupplierExtraFields=Attributs supplémentaires (Prix fournisseur) +ProductSupplierExtraFields=Attributs supplémentaires (Prix fournisseur) \ No newline at end of file diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 738b8b6ec18..0f1f0e01a87 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1623,31 +1623,6 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead print ''; // end div class="login_block_other" + + + // Add login user link + $toprightmenu .= ''."\n"; + print $toprightmenu; @@ -1940,7 +1939,7 @@ function top_menu_bookmark() $langs->load("bookmarks"); $html .= ' - '; - - $html .= '