diff --git a/.travis.yml b/.travis.yml index fc892b7178b..db0f3196cf8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ # from Dolibarr GitHub repository. # For syntax, see http://about.travis-ci.org/docs/user/languages/php/ +dist: precise sudo: required language: php @@ -10,7 +11,7 @@ php: - '5.3' - '5.4' - '5.5' -- '5.6' +- '5.6.29' - '7.0' - '7.1' - nightly @@ -58,7 +59,7 @@ matrix: allow_failures: - php: 7.1 - php: nightly - - env: DB=postgresql + #- env: DB=postgresql # TODO #- env: DB=sqlite @@ -261,18 +262,16 @@ script: echo "Checking PHP syntax errors" # Ensure we catch errors set -e - #parallel-lint --exclude htdocs/includes --blame . + parallel-lint --exclude htdocs/includes --blame . set +e echo -# TODO: dev/* checks - - | echo "Checking coding style" # Ensure we catch errors set -e # Exclusions are defined in the ruleset.xml file - #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . + phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . set +e echo @@ -280,8 +279,6 @@ script: # TODO: Check CSS (csslint?) -# TODO: check SQL syntax (pgsanity?) - - | echo "Upgrading Dolibarr" # Ensure we catch errors diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 10322c68077..9af3d0d19d9 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -73,7 +73,7 @@ if ($action == 'validatehistory') { // First clean corrupted data $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; - $sqlclean .= " SET fd.fk_code_ventilation = 0"; + $sqlclean .= " SET fk_code_ventilation = 0"; $sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN '; $sqlclean .= ' (SELECT accnt.rowid '; $sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; @@ -91,7 +91,7 @@ if ($action == 'validatehistory') { $sql1 .= " AND " . MAIN_DB_PREFIX . "facturedet.fk_code_ventilation = 0"; } else { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " SET fd.fk_code_ventilation = accnt.rowid"; + $sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_sell=accnt.account_number"; $sql1 .= " AND fd.fk_code_ventilation = 0"; @@ -113,7 +113,7 @@ if ($action == 'validatehistory') { $db->begin(); $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; - $sql1 .= " SET fd.fk_code_ventilation = 0"; + $sql1 .= " SET fk_code_ventilation = 0"; $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN '; $sql1 .= ' (SELECT accnt.rowid '; $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; @@ -134,16 +134,16 @@ if ($action == 'validatehistory') { } elseif ($action == 'cleanaccountancycode') { $error = 0; $db->begin(); - + // Now clean $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; - $sql1.= " SET fd.fk_code_ventilation = 0"; + $sql1.= " SET fk_code_ventilation = 0"; $sql1.= " WHERE fd.fk_facture IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture as f"; $sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; $sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'"; $sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")"; $sql1.=")"; - + dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); $resql1 = $db->query($sql1); @@ -327,7 +327,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. print '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . ''; } print '' . $langs->trans("Total") . ''; - + $sql = "SELECT '" . $langs->trans("TotalVente") . "' AS total,"; for($i = 1; $i <= 12; $i ++) { $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index f751d78b1a6..1a18e89792a 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -134,7 +134,7 @@ if ($result) { $compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $account_vat); // Define array to display all VAT rates that use this accounting account $compta_tva - if ((! price2num($obj->tva_tx)) || ! empty($obj->vat_src_code)) + if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code)) { $def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')); } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index e80ae3ba059..cbe793deb63 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -145,7 +145,7 @@ if ($result) { $compta_tva = (! empty($vatdata['accountancy_code_buy']) ? $vatdata['accountancy_code_buy'] : $cpttva); // Define array to display all VAT rates that use this accounting account $compta_tva - if ((! price2num($obj->tva_tx)) || ! empty($obj->vat_src_code)) + if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code)) { $def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')); } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index e374ab62c5c..cf92905e041 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -150,7 +150,7 @@ if ($result) { $compta_tva = (! empty($vatdata['accountancy_code_sell']) ? $vatdata['accountancy_code_sell'] : $cpttva); // Define array to display all VAT rates that use this accounting account $compta_tva - if ((! price2num($obj->tva_tx)) || ! empty($obj->vat_src_code)) + if (price2num($obj->tva_tx) || ! empty($obj->vat_src_code)) { $def_tva[$obj->rowid][$compta_tva][vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')]=(vatrate($obj->tva_tx).($obj->vat_src_code?' ('.$obj->vat_src_code.')':'')); } @@ -674,7 +674,8 @@ if (empty($action) || $action == 'view') { } else print $accountoshow; print ""; - print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT") . ""; // ' '.join(', ',$def_tva[$key][$k]). + print "" . $companystatic->getNomUrl(0, 'customer', 16) . ' - ' . $invoicestatic->ref . ' - ' . $langs->trans("VAT"). ' '.join(', ',$def_tva[$key][$k]); + print ""; // print "" . $langs->trans("VAT") . ""; print "" . ($mt < 0 ? price(- $mt) : '') . ""; print "" . ($mt >= 0 ? price($mt) : '') . ""; diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 3aa8e501bb9..fb5f28fc27d 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -69,14 +69,14 @@ if ($action == 'validatehistory') { // First clean corrupted data $sqlclean = "UPDATE " . MAIN_DB_PREFIX . "facturedet as fd"; - $sqlclean .= " SET fd.fk_code_ventilation = 0"; + $sqlclean .= " SET fk_code_ventilation = 0"; $sqlclean .= ' WHERE fd.fk_code_ventilation NOT IN '; $sqlclean .= ' (SELECT accnt.rowid '; $sqlclean .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; $sqlclean .= ' INNER JOIN ' . MAIN_DB_PREFIX . 'accounting_system as syst'; $sqlclean .= ' ON accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=' . $conf->global->CHARTOFACCOUNTS . ')'; $resql = $db->query($sqlclean); - + // Now make the binding. Bind automatically only for product with a dedicated account that exists into chart of account, others need a manual bind if ($db->type == 'pgsql') { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det"; @@ -87,7 +87,7 @@ if ($action == 'validatehistory') { $sql1 .= " AND " . MAIN_DB_PREFIX . "facture_fourn_det.fk_code_ventilation = 0"; } else { $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd, " . MAIN_DB_PREFIX . "product as p, " . MAIN_DB_PREFIX . "accounting_account as accnt , " . MAIN_DB_PREFIX . "accounting_system as syst"; - $sql1 .= " SET fd.fk_code_ventilation = accnt.rowid"; + $sql1 .= " SET fk_code_ventilation = accnt.rowid"; $sql1 .= " WHERE fd.fk_product = p.rowid AND accnt.fk_pcg_version = syst.pcg_version AND syst.rowid=" . $conf->global->CHARTOFACCOUNTS; $sql1 .= " AND accnt.active = 1 AND p.accountancy_code_buy=accnt.account_number"; $sql1 .= " AND fd.fk_code_ventilation = 0"; @@ -107,7 +107,7 @@ if ($action == 'validatehistory') { $db->begin(); $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; - $sql1 .= " SET fd.fk_code_ventilation = 0"; + $sql1 .= " SET fk_code_ventilation = 0"; $sql1 .= ' WHERE fd.fk_code_ventilation NOT IN '; $sql1 .= ' (SELECT accnt.rowid '; $sql1 .= ' FROM ' . MAIN_DB_PREFIX . 'accounting_account as accnt'; @@ -130,13 +130,13 @@ if ($action == 'validatehistory') { $db->begin(); $sql1 = "UPDATE " . MAIN_DB_PREFIX . "facture_fourn_det as fd"; - $sql1.= " SET fd.fk_code_ventilation = 0"; + $sql1.= " SET fk_code_ventilation = 0"; $sql1.= " WHERE fd.fk_facture_fourn IN ( SELECT f.rowid FROM " . MAIN_DB_PREFIX . "facture_fourn as f"; $sql1.= " WHERE f.datef >= '" . $db->idate(dol_get_first_day($year_current, 1, false)) . "'"; $sql1.= " AND f.datef <= '" . $db->idate(dol_get_last_day($year_current, 12, false)) . "'"; $sql1.= " AND f.entity IN (" . getEntity('accountancy') . ")"; $sql1.= ")"; - + dol_syslog("htdocs/accountancy/customer/index.php fixaccountancycode", LOG_DEBUG); $resql1 = $db->query($sql1); @@ -291,9 +291,9 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. { print '
'; print '
'; - + print_fiche_titre($langs->trans("OtherInfo"), '', ''); - + print "
\n"; print ''; print ''; @@ -301,7 +301,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. print ''; } print ''; - + $sql = "SELECT '" . $langs->trans("CAHTF") . "' AS label,"; for($i = 1; $i <= 12; $i ++) { $sql .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ","; @@ -313,15 +313,15 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. $sql .= " AND ff.datef <= '" . $db->idate(dol_get_last_day($y, 12, false)) . "'"; $sql .= " AND ff.fk_statut > 0 "; $sql .= " AND ff.entity IN (" . getEntity('facture_fourn', 0) . ")"; // We don't share object for accountancy - + dol_syslog('/accountancy/supplier/index.php:: sql=' . $sql); $resql = $db->query($sql); if ($resql) { $num = $db->num_rows($resql); - + while ( $row = $db->fetch_row($resql)) { - - + + print ''; for($i = 1; $i <= 12; $i ++) { print ''; @@ -329,7 +329,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) // This part of code looks strange. print ''; print ''; } - + $db->free($resql); } else { print $db->lasterror(); // Show last sql error diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index cc35aed19be..123877f7f4e 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -50,6 +50,7 @@ $action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view'; $confirm=GETPOST('confirm','alpha'); $id=GETPOST('id','int'); $rowid=GETPOST('rowid','alpha'); +$search_label=GETPOST('search_label','alpha'); $allowed=$user->admin; if (! $allowed) accessforbidden(); @@ -78,10 +79,6 @@ $hookmanager->initHooks(array('emailtemplates')); $tabname=array(); $tabname[25]= MAIN_DB_PREFIX."c_email_templates"; -// Requests to extract data -$tabsql=array(); -$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template').")"; - // Criteria to sort dictionaries $tabsqlsort=array(); $tabsqlsort[25]="label ASC"; @@ -173,211 +170,223 @@ $id = 25; * Actions */ -if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x')) -{ - //$search_country_id = ''; -} +if (GETPOST('cancel')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } -// Actions add or modify an entry into a dictionary -if (GETPOST('actionadd') || GETPOST('actionmodify')) -{ - $listfield=explode(',', str_replace(' ', '',$tabfield[$id])); - $listfieldinsert=explode(',',$tabfieldinsert[$id]); - $listfieldmodify=explode(',',$tabfieldinsert[$id]); - $listfieldvalue=explode(',',$tabfieldvalue[$id]); +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - // Check that all fields are filled - $ok=1; - foreach ($listfield as $f => $value) +if (empty($reshook)) +{ + // Purge search criteria + if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") ||GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { - if ($value == 'content') continue; - if ($value == 'content_lines') continue; - if ($value == 'content') $value='content-'.$rowid; - if ($value == 'content_lines') $value='content_lines-'.$rowid; - - if (! isset($_POST[$value]) || $_POST[$value]=='') - { - $ok=0; - $fieldnamekey=$listfield[$f]; - // We take translate key of field - if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; - if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments'; - if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; - if ($fieldnamekey == 'note') $fieldnamekey = 'Note'; - if ($fieldnamekey == 'type') $fieldnamekey = 'Type'; - - setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); - } + $search_label=''; + $toselect=''; + $search_array_options=array(); } - // Si verif ok et action add, on ajoute la ligne - if ($ok && GETPOST('actionadd')) + // Actions add or modify an entry into a dictionary + if (GETPOST('actionadd') || GETPOST('actionmodify')) { - if ($tabrowid[$id]) + $listfield=explode(',', str_replace(' ', '',$tabfield[$id])); + $listfieldinsert=explode(',',$tabfieldinsert[$id]); + $listfieldmodify=explode(',',$tabfieldinsert[$id]); + $listfieldvalue=explode(',',$tabfieldvalue[$id]); + + // Check that all fields are filled + $ok=1; + foreach ($listfield as $f => $value) { - // Recupere id libre pour insertion - $newid=0; - $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; - $result = $db->query($sql); - if ($result) + if ($value == 'content') continue; + if ($value == 'content_lines') continue; + if ($value == 'content') $value='content-'.$rowid; + if ($value == 'content_lines') $value='content_lines-'.$rowid; + + if (! isset($_POST[$value]) || $_POST[$value]=='') { - $obj = $db->fetch_object($result); - $newid=($obj->newid + 1); + $ok=0; + $fieldnamekey=$listfield[$f]; + // We take translate key of field + if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label'; + if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments'; + if ($fieldnamekey == 'code') $fieldnamekey = 'Code'; + if ($fieldnamekey == 'note') $fieldnamekey = 'Note'; + if ($fieldnamekey == 'type') $fieldnamekey = 'Type'; - } else { - dol_print_error($db); + setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors'); } } - // Add new entry - $sql = "INSERT INTO ".$tabname[$id]." ("; - // List of fields - if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert)) - $sql.= $tabrowid[$id].","; - $sql.= $tabfieldinsert[$id]; - $sql.=",active)"; - $sql.= " VALUES("; + // Si verif ok et action add, on ajoute la ligne + if ($ok && GETPOST('actionadd')) + { + if ($tabrowid[$id]) + { + // Recupere id libre pour insertion + $newid=0; + $sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id]; + $result = $db->query($sql); + if ($result) + { + $obj = $db->fetch_object($result); + $newid=($obj->newid + 1); - // List of values - if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert)) - $sql.= $newid.","; - $i=0; - foreach ($listfieldinsert as $f => $value) - { - //var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value); - if ($value == 'entity') { - $_POST[$listfieldvalue[$i]] = $conf->entity; + } else { + dol_print_error($db); + } } - if ($i) $sql.=","; - if ($value == 'private' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='0'; - if ($value == 'position' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='1'; - if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = '' - else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; - $i++; - } - $sql.=",1)"; - dol_syslog("actionadd", LOG_DEBUG); - $result = $db->query($sql); - if ($result) // Add is ok - { - setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); - $_POST=array('id'=>$id); // Clean $_POST array, we keep only - } - else - { - if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); + // Add new entry + $sql = "INSERT INTO ".$tabname[$id]." ("; + // List of fields + if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert)) + $sql.= $tabrowid[$id].","; + $sql.= $tabfieldinsert[$id]; + $sql.=",active)"; + $sql.= " VALUES("; + + // List of values + if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert)) + $sql.= $newid.","; + $i=0; + foreach ($listfieldinsert as $f => $value) + { + //var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value); + if ($value == 'entity') { + $_POST[$listfieldvalue[$i]] = $conf->entity; + } + if ($i) $sql.=","; + if ($value == 'private' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='0'; + if ($value == 'position' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='1'; + if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = '' + else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $i++; } - else { - dol_print_error($db); + $sql.=",1)"; + + dol_syslog("actionadd", LOG_DEBUG); + $result = $db->query($sql); + if ($result) // Add is ok + { + setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); + $_POST=array('id'=>$id); // Clean $_POST array, we keep only + } + else + { + if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { + setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); + } + else { + dol_print_error($db); + } + } + } + + // Si verif ok et action modify, on modifie la ligne + if ($ok && GETPOST('actionmodify')) + { + if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } + else { $rowidcol="rowid"; } + + // Modify entry + $sql = "UPDATE ".$tabname[$id]." SET "; + // Modifie valeur des champs + if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify)) + { + $sql.= $tabrowid[$id]."="; + $sql.= "'".$db->escape($rowid)."', "; + } + $i = 0; + foreach ($listfieldmodify as $field) + { + if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid]; + if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid]; + if ($field == 'entity') { + $_POST[$listfieldvalue[$i]] = $conf->entity; + } + if ($i) $sql.=","; + $sql.= $field."="; + if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = '' + else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; + $i++; + } + $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; + + dol_syslog("actionmodify", LOG_DEBUG); + //print $sql; + $resql = $db->query($sql); + if (! $resql) + { + setEventMessages($db->error(), null, 'errors'); } } } - // Si verif ok et action modify, on modifie la ligne - if ($ok && GETPOST('actionmodify')) + if ($action == 'confirm_delete' && $confirm == 'yes') // delete { if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } else { $rowidcol="rowid"; } - // Modify entry - $sql = "UPDATE ".$tabname[$id]." SET "; - // Modifie valeur des champs - if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify)) - { - $sql.= $tabrowid[$id]."="; - $sql.= "'".$db->escape($rowid)."', "; - } - $i = 0; - foreach ($listfieldmodify as $field) - { - if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid]; - if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid]; - if ($field == 'entity') { - $_POST[$listfieldvalue[$i]] = $conf->entity; - } - if ($i) $sql.=","; - $sql.= $field."="; - if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = '' - else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'"; - $i++; - } - $sql.= " WHERE ".$rowidcol." = '".$rowid."'"; + $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; - dol_syslog("actionmodify", LOG_DEBUG); - //print $sql; - $resql = $db->query($sql); - if (! $resql) + dol_syslog("delete", LOG_DEBUG); + $result = $db->query($sql); + if (! $result) { - setEventMessages($db->error(), null, 'errors'); + if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') + { + setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); + } + else + { + dol_print_error($db); + } } } -} -if ($action == 'confirm_delete' && $confirm == 'yes') // delete -{ - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } - - $sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'"; - - dol_syslog("delete", LOG_DEBUG); - $result = $db->query($sql); - if (! $result) + // activate + if ($action == $acts[0]) { - if ($db->errno() == 'DB_ERROR_CHILD_EXISTS') - { - setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); + if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } + else { $rowidcol="rowid"; } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'"; } - else + elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'"; + } + + $result = $db->query($sql); + if (!$result) + { + dol_print_error($db); + } + } + + // disable + if ($action == $acts[1]) + { + if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } + else { $rowidcol="rowid"; } + + if ($rowid) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'"; + } + elseif ($code) { + $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'"; + } + + $result = $db->query($sql); + if (!$result) { dol_print_error($db); } } } -// activate -if ($action == $acts[0]) -{ - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'"; - } - elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$code."'"; - } - - $result = $db->query($sql); - if (!$result) - { - dol_print_error($db); - } -} - -// disable -if ($action == $acts[1]) -{ - if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; } - else { $rowidcol="rowid"; } - - if ($rowid) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'"; - } - elseif ($code) { - $sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$code."'"; - } - - $result = $db->query($sql); - if (!$result) - { - dol_print_error($db); - } -} - - /* * View @@ -416,8 +425,11 @@ if ($action == 'delete') } //var_dump($elementList); -// Complete requete recherche valeurs avec critere de tri -$sql=$tabsql[$id]; + +$sql="SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active"; +$sql.=" FROM ".MAIN_DB_PREFIX."c_email_templates"; +$sql.=" WHERE entity IN (".getEntity('email_template').")"; +if ($search_label) $sql.=natural_search('label', $search_label); if ($search_country_id > 0) { @@ -572,9 +584,19 @@ if ($action != 'edit') $colspan=count($fieldlist)+1; - print ''; // Keep   to have a line with enough height + //print ''; // Keep   to have a line with enough height } +print '
' . $langs->trans("Total") . '' . $langs->trans('MonthShort' . str_pad($i, 2, '0', STR_PAD_LEFT)) . '' . $langs->trans("Total") . '
' . $row[0] . '' . price($row[$i]) . '' . price($row[13]) . '
 
 
'; +print ''; + +print '
'; + +print '
'; +print ''; +print ''; + +print ''; // List of available record in database dol_syslog("htdocs/admin/dict", LOG_DEBUG); @@ -599,8 +621,26 @@ if ($resql) print ''; } + + // Title line with search boxes + print ''; + $filterfound=0; + foreach ($fieldlist as $field => $value) + { + if ($value == 'label') print ''; + elseif (! in_array($value, array('content', 'content_lines'))) print ''; + } + if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print ''; + print ''; + // Action column + print ''; + print ''; + // Title of lines - print ''; + print ''; foreach ($fieldlist as $field => $value) { // Determine le nom du champ par rapport aux noms possibles @@ -642,18 +682,6 @@ if ($resql) print getTitleFieldOfList(''); print ''; - // Title line with search boxes - print ''; - $filterfound=0; - foreach ($fieldlist as $field => $value) - { - if (! in_array($field, array('content', 'content_lines'))) print ''; - } - if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print ''; - print ''; - print ''; - print ''; - if ($num) { // Lines with values diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 3aa6ad5dc26..ac5ab678109 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -61,7 +61,7 @@ if (preg_match('/set_(.*)/',$action,$reg)) dol_print_error($db); } } - + if (preg_match('/del_(.*)/',$action,$reg)) { $code=$reg[1]; @@ -79,7 +79,7 @@ if (preg_match('/del_(.*)/',$action,$reg)) if ($action == 'add_currency') { $langs->loadCacheCurrencies(''); - + $code = GETPOST('code', 'alpha'); $rate = GETPOST('rate', 'alpha'); $currency = new MultiCurrency($db); @@ -96,23 +96,23 @@ if ($action == 'add_currency') elseif ($action == 'update_currency') { $submit = GETPOST('submit', 'alpha'); - + if ($submit == $langs->trans('Modify')) { $fk_multicurrency = GETPOST('fk_multicurrency', 'int'); $rate = GETPOST('rate', 'float'); $currency = new MultiCurrency($db); - + if ($currency->fetch($fk_multicurrency) > 0) { $currency->updateRate($rate); - } + } } elseif ($submit == $langs->trans('Delete')) { $fk_multicurrency = GETPOST('fk_multicurrency', 'int'); $currency = new MultiCurrency($db); - + if ($currency->fetch($fk_multicurrency) > 0) { if ($currency->delete() > 0) setEventMessages($langs->trans('RecordDeleted'), array()); @@ -120,14 +120,14 @@ elseif ($action == 'update_currency') } } } -elseif ($action == 'synchronize') +elseif ($action == 'synchronize') { $response = GETPOST('response'); $response = json_decode($response); - + if ($response->success) { - MultiCurrency::syncRates($response); + MultiCurrency::syncRates($response); } else { @@ -159,19 +159,12 @@ $page_name = "MultiCurrencySetup"; llxHeader('', $langs->trans($page_name)); // Subheader -$linkback = '' - . $langs->trans("BackToModuleList") . ''; +$linkback = '' . $langs->trans("BackToModuleList") . ''; print_fiche_titre($langs->trans($page_name), $linkback); // Configuration header $head = multicurrencyAdminPrepareHead(); -dol_fiche_head( - $head, - 'settings', - $langs->trans("ModuleSetup"), - 0, - "multicurrency" -); +dol_fiche_head($head, 'settings', $langs->trans("ModuleSetup"), -1, "multicurrency"); // Setup page goes here $form=new Form($db); @@ -225,7 +218,7 @@ print ''; print ''; */ -/* TODO uncomment when the functionality will integrated +/* TODO uncomment when the functionality will integrated print ''; print ''; @@ -258,9 +251,9 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print $langs->trans("Value").' '; print ''; print ''; - - - + + + print ''; print ''; print ''; @@ -272,8 +265,8 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''; print ''; print ''; - - + + print ''; print ''; print ''; @@ -285,8 +278,8 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''; print ''; print ''; - - + + print ''; print ''; print ''; @@ -298,7 +291,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''; print ''; print ''; - + print '
'; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; + print '
'.$langs->transnoentitiesnoconv("multicurrency_modifyRateApplication").'
'.$langs->transnoentitiesnoconv("multicurrency_appId").' 
'.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").' 
'.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").' 
'; print '
'; } @@ -333,8 +326,8 @@ print ''; foreach ($TCurrency as &$currency) { if($currency->code == $conf->currency) continue; - - + + print ''; print ''.$currency->code.' - '.$currency->name.''; print ' '; @@ -362,7 +355,7 @@ print ' { $("#bt_sync").attr("disabled", true); var url_sync = "http://apilayer.net/api/live?access_key='.$conf->global->MULTICURRENCY_APP_ID.'&format=1'.(!empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '&source='.$conf->global->MULTICURRENCY_APP_SOURCE : '').'"; - + $.ajax({ url: url_sync, dataType: "jsonp" diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 65933c25639..75de985728c 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -88,7 +88,7 @@ if ($action == 'set') $newActiveModules = array(); $selectedModules = (isset($_POST['SYSLOG_HANDLERS']) ? $_POST['SYSLOG_HANDLERS'] : array()); - + // Save options of handler foreach ($syslogModules as $syslogHandler) { @@ -111,7 +111,7 @@ if ($action == 'set') $activeModules = $newActiveModules; - dolibarr_del_const($db, 'SYSLOG_HANDLERS', -1); // To be sure ther is not a setup into another entity + dolibarr_del_const($db, 'SYSLOG_HANDLERS', -1); // To be sure ther is not a setup into another entity dolibarr_set_const($db, 'SYSLOG_HANDLERS', json_encode($activeModules), 'chaine',0,'',0); // Check configuration @@ -206,7 +206,7 @@ foreach ($syslogModules as $moduleName) //print $moduleName." = ".$moduleactive." - ".$module->getName()." ".($moduleactive == -1)."
\n"; if (($moduleactive == -1) && empty($conf->global->MAIN_FEATURES_LEVEL)) continue; // Some modules are hidden if not activable and not into debug mode (end user must not see them) - + print ''; print ''; print ' '; @@ -229,6 +229,14 @@ foreach ($syslogModules as $moduleName) print $option['name'].': '; if (! empty($option['example'])) print '
'.$langs->trans("Example").': '.$option['example']; + + if ($option['constant'] == 'SYSLOG_FILE' && preg_match('/^DOL_DATA_ROOT\/[^\/]*$/',$value)) + { + $filelogparam =' ('; + $filelogparam.=$langs->trans('Download'); + $filelogparam.=$filelog.')'; + print $filelogparam; + } } } print ''; diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index 40ebcd69dc6..fc1d2b72fdf 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Bahfir Abbes * @@ -45,15 +45,17 @@ $langs->load("companies"); $langs->load("users"); $langs->load("other"); -$sortfield = GETPOST("sortfield",'alpha'); -$sortorder = GETPOST("sortorder",'alpha'); -$page = GETPOST("page",'int'); -if ($page == -1) { $page = 0 ; } -$offset = $conf->liste_limit * $page ; +// Load variable for pagination +$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="dateevent"; +if (! $sortorder) $sortorder="DESC"; $search_code = GETPOST("search_code"); $search_ip = GETPOST("search_ip"); @@ -61,9 +63,9 @@ $search_user = GETPOST("search_user"); $search_desc = GETPOST("search_desc"); $search_ua = GETPOST("search_ua"); -if (!isset($_REQUEST["date_startmonth"]) || $_REQUEST["date_startmonth"] > 0) $date_start=dol_mktime(0,0,0,$_REQUEST["date_startmonth"],$_REQUEST["date_startday"],$_REQUEST["date_startyear"]); +if (GETPOST("date_startmonth") == '' || GETPOST("date_startmonth") > 0) $date_start=dol_mktime(0,0,0,GETPOST("date_startmonth"),GETPOST("date_startday"),GETPOST("date_startyear")); else $date_start=-1; -if (!isset($_REQUEST["date_endmonth"]) || $_REQUEST["date_endmonth"] > 0) $date_end=dol_mktime(23,59,59,$_REQUEST["date_endmonth"],$_REQUEST["date_endday"],$_REQUEST["date_endyear"]); +if (GETPOST("date_endmonth") == '' || GETPOST("date_endmonth") > 0) $date_end=dol_mktime(23,59,59,GETPOST("date_endmonth"),GETPOST("date_endday"),GETPOST("date_endyear")); else $date_end=-1; // checks:if date_start>date_end then date_end=date_start + 24 hours @@ -72,14 +74,6 @@ if ($date_start > 0 && $date_end > 0 && $date_start > $date_end) $date_end=$date $now = dol_now(); $nowarray = dol_getdate($now); -$params = "&search_code=$search_code&search_ip=$search_ip&search_user=$search_user&search_desc=$search_desc&search_ua=$search_ua"; -$params.= "&date_startmonth=".$_REQUEST["date_startmonth"]; -$params.= "&date_startday=".$_REQUEST["date_startday"]; -$params.= "&date_startyear=".$_REQUEST["date_startyear"]; -$params.= "&date_endmonth=".$_REQUEST["date_endmonth"]; -$params.= "&date_endday=".$_REQUEST["date_endday"]; -$params.= "&date_endyear=".$_REQUEST["date_endyear"]; - if (empty($date_start)) // We define date_start and date_end { $date_start=dol_get_first_day($nowarray['year'],$nowarray['mon'],false); @@ -88,6 +82,15 @@ if (empty($date_end)) { $date_end=dol_mktime(23,59,59,$nowarray['mon'],$nowarray['mday'],$nowarray['year']); } +// Set $date_startmonth... +$tmp = dol_getdate($date_start); +$date_startday = $tmp['mday']; +$date_startmonth = $tmp['mon']; +$date_startyear = $tmp['year']; +$tmp = dol_getdate($date_end); +$date_endday = $tmp['mday']; +$date_endmonth = $tmp['mon']; +$date_endyear = $tmp['year']; /* @@ -97,7 +100,7 @@ if (empty($date_end)) $now=dol_now(); // Purge search criteria -if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // Both test are required to be compatible with all browsers +if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETPOST("button_removefilter")) // All tests are required to be compatible with all browsers { $date_start=-1; $date_end=-1; @@ -192,39 +195,39 @@ if ($result) $i = 0; $param=''; - if ($search_code) $param.='&search_code='.$search_code; - if ($search_ip) $param.='&search_ip='.$search_ip; - if ($search_user) $param.='&search_user='.$search_user; - if ($search_desc) $param.='&search_desc='.$search_desc; - if ($search_ua) $param.='&search_ua='.$search_ua; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + if ($optioncss != '') $param.='&optioncss='.$optioncss; + if ($search_code) $param.='&search_code='.urlencode($search_code); + if ($search_ip) $param.='&search_ip='.urlencode($search_ip); + if ($search_user) $param.='&search_user='.urlencode($search_user); + if ($search_desc) $param.='&search_desc='.urlencode($search_desc); + if ($search_ua) $param.='&search_ua='.urlencode($search_ua); + if ($date_startmonth) $param.= "&date_startmonth=".urlencode($date_startmonth); + if ($date_startday) $param.= "&date_startday=".urlencode($date_startday); + if ($date_startyear) $param.= "&date_startyear=".urlencode($date_startyear); + if ($date_endmonth) $param.= "&date_endmonth=".urlencode($date_endmonth); + if ($date_endday) $param.= "&date_endday=".urlencode($date_endday); + if ($date_endyear) $param.= "&date_endyear=".urlencode($date_endyear); $langs->load('withdrawals'); if ($num) { $center=''.$langs->trans("Purge").''; } - - print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup'); + + print '
'; + + print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup', 0, '', '', $limit); if ($action == 'purge') { $formquestion=array(); print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeAuditEvents'), $langs->trans('ConfirmPurgeAuditEvents'),'confirm_purge',$formquestion,'no',1); } - - print ''; print '
'; print ''; - print ''; - print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","","",'align="left"',$sortfield,$sortorder); - print_liste_field_titre(''); - print "\n"; - // Lignes des champs de filtres print ''; @@ -255,14 +258,20 @@ if ($result) print "\n"; - $var=True; - while ($i < min($num, $conf->liste_limit)) + print ''; + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Code"),$_SERVER["PHP_SELF"],"e.type","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("IP"),$_SERVER["PHP_SELF"],"e.ip","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"u.login","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Description"),$_SERVER["PHP_SELF"],"e.description","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre(''); + print "\n"; + + while ($i < min($num, $limit)) { $obj = $db->fetch_object($result); - - print ''; // Date @@ -316,7 +325,7 @@ if ($result) } print "
"; print "
"; - + print "
"; $db->free($result); } diff --git a/htdocs/admin/tools/purge.php b/htdocs/admin/tools/purge.php index e913d59a4a7..7a5cb30ae75 100644 --- a/htdocs/admin/tools/purge.php +++ b/htdocs/admin/tools/purge.php @@ -83,7 +83,15 @@ if (! empty($conf->syslog->enabled)) { print ' '.$langs->trans("PurgeDeleteLogFile",$filelog).'

'; + $filelogparam=$filelog; + if ($user->admin && preg_match('/^dolibarr.*\.log$/', basename($filelog))) + { + $filelogparam =''.$filelog.''; + } + print '> '.$langs->trans("PurgeDeleteLogFile", $filelogparam); + print '

'; } print ' - * Copyright (C) 2006-2015 Laurent Destailleur + * Copyright (C) 2006-2017 Laurent Destailleur * Copyright (C) 2005-2014 Regis Houssin * Copyright (C) 2007 Patrick Raguin * Copyright (C) 2013 Florian Henry @@ -221,9 +221,7 @@ llxHeader("",$langs->trans("Categories"),$helpurl); if ($user->rights->categorie->creer) { - /* - * Fiche en mode creation - */ + // Create or add if ($action == 'create' || $_POST["addcat"] == 'addcat') { dol_set_focus('#label'); @@ -246,7 +244,7 @@ if ($user->rights->categorie->creer) // Ref print ''; - print ''.$langs->trans("Ref").''; + print ''.$langs->trans("Ref").''; print''; // Description @@ -263,7 +261,8 @@ if ($user->rights->categorie->creer) // Parent category print ''.$langs->trans("AddIn").''; - print $form->select_all_categories($type, $catorigin); + print $form->select_all_categories($type, $catorigin, 'parent'); + print ajax_combobox('parent'); print ''; $parameters=array(); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 67dbca101f8..0c9d97fc299 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1360,7 +1360,7 @@ if ($action == 'create') } } else { print ''; - print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty'); + print $form->select_company('', 'socid', '(s.client = 1 OR s.client = 2 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f837119730c..a10de641ea1 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1477,7 +1477,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; } else { print ''; - print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty'); + print $form->select_company('', 'socid', 's.client = 1 OR s.client = 3', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // reload page to retrieve customer informations if (!empty($conf->global->RELOAD_PAGE_ON_CUSTOMER_CHANGE)) { diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 8967e22a160..ed9f8906804 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -76,7 +76,7 @@ if ($mode == 'customer') if ($mode == 'supplier') { $title=$langs->trans("OrdersStatisticsSuppliers").' ('.$langs->trans("SentToSuppliers").")"; - $dir=$conf->fournisseur->dir_output.'/commande/temp'; + $dir=$conf->fournisseur->commande->dir_temp; } llxHeader('', $title); @@ -322,7 +322,7 @@ foreach ($data as $val) while (! empty($year) && $oldyear > $year+1) { // If we have empty year $oldyear--; - + print ''; print '0?'&userid='.$userid:'').'">'.$oldyear.''; print '0'; @@ -334,7 +334,7 @@ foreach ($data as $val) print ''; } - + print ''; print '0?'&userid='.$userid:'').'">'.$year.''; print ''.$val['nb'].''; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 45cbbfe3a46..6043a7cbec5 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -492,14 +492,14 @@ if (! empty($conf->salaries->enabled)) } else { $column = 'p.datep'; } - + $subtotal_ht = 0; $subtotal_ttc = 0; $sql = "SELECT p.label as nom, date_format($column,'%Y-%m') as dm, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as p"; $sql.= " WHERE p.entity = ".$conf->entity; $sql.= " GROUP BY p.label, dm"; - + dol_syslog("get social salaries payments"); $result=$db->query($sql); if ($result) @@ -512,13 +512,13 @@ if (! empty($conf->salaries->enabled)) while ($i < $num) { $obj = $db->fetch_object($result); - + if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0; $decaiss[$obj->dm] += $obj->amount; - + if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0; $decaiss_ttc[$obj->dm] += $obj->amount; - + $i++; } } @@ -568,7 +568,7 @@ if (! empty($conf->expensereport->enabled)) { if (! isset($decaiss[$obj->dm])) $decaiss[$obj->dm]=0; $decaiss[$obj->dm] += $obj->amount_ht; - + if (! isset($decaiss_ttc[$obj->dm])) $decaiss_ttc[$obj->dm]=0; $decaiss_ttc[$obj->dm] += $obj->amount_ttc; @@ -588,7 +588,7 @@ if (! empty($conf->don->enabled)) { $subtotal_ht = 0; $subtotal_ttc = 0; - + if ($modecompta == 'CREANCES-DETTES') { $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; @@ -617,13 +617,13 @@ if (! empty($conf->don->enabled)) while ($i < $num) { $obj = $db->fetch_object($result); - + if (! isset($encaiss[$obj->dm])) $encaiss[$obj->dm]=0; $encaiss[$obj->dm] += $obj->amount; - + if (! isset($encaiss_ttc[$obj->dm])) $encaiss_ttc[$obj->dm]=0; $encaiss_ttc[$obj->dm] += $obj->amount; - + $i++; } } @@ -671,7 +671,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) { $mois_modulo = $mois; if($mois>12) {$mois_modulo = $mois-12;} - + print ''; print "".dol_print_date(dol_mktime(12,0,0,$mois_modulo,1,$annee),"%B").""; for ($annee = $year_start ; $annee <= $year_end ; $annee++) @@ -680,7 +680,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) if($mois>12) {$annee_decalage=$annee+1;} $case = strftime("%Y-%m",dol_mktime(12,0,0,$mois_modulo,1,$annee_decalage)); - print ' '; + print ' '; if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0) { print ''.price(price2num($decaiss_ttc[$case],'MT')).''; @@ -689,7 +689,7 @@ for ($mois = 1+$nb_mois_decalage ; $mois <= 12+$nb_mois_decalage ; $mois++) } print ""; - print ' '; + print ' '; //if (isset($encaiss_ttc[$case]) && $encaiss_ttc[$case] != 0) if (isset($encaiss_ttc[$case])) { diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index 22b26983bcc..a273443ef7c 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -275,7 +275,7 @@ class Fiscalyear extends CommonObject if ($mode == 5) { if ($statut==0 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut4'); - if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut8'); + if ($statut==1 && ! empty($this->statuts_short[$statut])) return $langs->trans($this->statuts_short[$statut]).' '.img_picto($langs->trans($this->statuts_short[$statut]),'statut6'); } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 7c8efcc8328..1a19d0da776 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -995,7 +995,7 @@ class Form unset($societetmp); } // mode 1 - $urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter; + $urloption='htmlname='.$htmlname.'&outjson=1&filter='.$filter.($showtype?'&showtype='.$showtype:''); $out.= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); $out.='