diff --git a/.travis.yml b/.travis.yml index dd3322e5cf7..613d2fa2420 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ # For syntax, see http://about.travis-ci.org/docs/user/languages/php/ # We use dist: xenial to have php 5.6+ available +os: linux dist: xenial sudo: required @@ -43,7 +44,7 @@ env: global: # Set to true for very verbose output - DEBUG=false - matrix: + jobs: # MariaDB overrides MySQL installation so it's not possible to test both yet #- DB=mariadb - DB=mysql @@ -53,7 +54,7 @@ env: # See https://github.com/DracoBlue/travis-ci-nginx-php-fpm-test #- WS=nginx -matrix: +jobs: fast_finish: true allow_failures: - php: nightly diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 1b83d5eb03f..6d59a9de1f6 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -45,7 +45,6 @@ $search_label = GETPOST('search_label', 'alpha'); $search_labelshort = GETPOST('search_labelshort', 'alpha'); $search_accountparent = GETPOST('search_accountparent', 'alpha'); $search_pcgtype = GETPOST('search_pcgtype', 'alpha'); -$search_pcgsubtype = GETPOST('search_pcgsubtype', 'alpha'); $chartofaccounts = GETPOST('chartofaccounts', 'int'); @@ -71,8 +70,7 @@ $arrayfields = array( 'aa.labelshort'=>array('label'=>$langs->trans("LabelToShow"), 'checked'=>1), 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1), 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), - 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'), - 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) + 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) ); $accounting = new AccountingAccount($db); @@ -103,7 +101,6 @@ if (empty($reshook)) $search_labelshort = ""; $search_accountparent = ""; $search_pcgtype = ""; - $search_pcgsubtype = ""; $search_array_options = array(); } if ((GETPOST('valid_change_chart', 'alpha') && GETPOST('chartofaccounts', 'int') > 0) // explicit click on button 'Change and load' with js on @@ -195,7 +192,7 @@ if ($action == 'delete') { $pcgver = $conf->global->CHARTOFACCOUNTS; -$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.pcg_subtype, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.active, "; +$sql = "SELECT aa.rowid, aa.fk_pcg_version, aa.pcg_type, aa.account_number, aa.account_parent , aa.label, aa.labelshort, aa.active, "; $sql .= " a2.rowid as rowid2, a2.label as label2, a2.account_number as account_number2"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as aa"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."accounting_system as asy ON aa.fk_pcg_version = asy.pcg_version AND aa.entity = ".$conf->entity; @@ -241,7 +238,6 @@ if (strlen(trim($search_label))) $sql .= natural_search("aa.label", $search_la if (strlen(trim($search_labelshort))) $sql .= natural_search("aa.labelshort", $search_labelshort); if (strlen(trim($search_accountparent)) && $search_accountparent != '-1') $sql .= natural_search("aa.account_parent", $search_accountparent, 2); if (strlen(trim($search_pcgtype))) $sql .= natural_search("aa.pcg_type", $search_pcgtype); -if (strlen(trim($search_pcgsubtype))) $sql .= natural_search("aa.pcg_subtype", $search_pcgsubtype); $sql .= $db->order($sortfield, $sortorder); // Count total nb of records @@ -274,8 +270,7 @@ if ($resql) if ($search_labelshort) $param .= '&search_labelshort='.urlencode($search_labelshort); if ($search_accountparent > 0 || $search_accountparent == '0') $param .= '&search_accountparent='.urlencode($search_accountparent); if ($search_pcgtype) $param .= '&search_pcgtype='.urlencode($search_pcgtype); - if ($search_pcgsubtype) $param .= '&search_pcgsubtype='.urlencode($search_pcgsubtype); - if ($optioncss != '') $param .= '&optioncss='.$optioncss; + if ($optioncss != '') $param .= '&optioncss='.$optioncss; if (!empty($conf->use_javascript_ajax)) { @@ -357,7 +352,6 @@ if ($resql) print ''; } if (!empty($arrayfields['aa.pcg_type']['checked'])) print ''; - if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print ''; if (!empty($arrayfields['aa.active']['checked'])) print ' '; print ''; $searchpicto = $form->showFilterAndCheckAddButtons($massactionbutton ? 1 : 0, 'checkforselect', 1); @@ -371,7 +365,6 @@ if ($resql) if (!empty($arrayfields['aa.labelshort']['checked'])) print_liste_field_titre($arrayfields['aa.labelshort']['label'], $_SERVER["PHP_SELF"], "aa.labelshort", "", $param, '', $sortfield, $sortorder); if (!empty($arrayfields['aa.account_parent']['checked'])) print_liste_field_titre($arrayfields['aa.account_parent']['label'], $_SERVER["PHP_SELF"], "aa.account_parent", "", $param, '', $sortfield, $sortorder, 'left '); if (!empty($arrayfields['aa.pcg_type']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_type']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_type', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_type']['help']); - if (!empty($arrayfields['aa.pcg_subtype']['checked'])) print_liste_field_titre($arrayfields['aa.pcg_subtype']['label'], $_SERVER["PHP_SELF"], 'aa.pcg_subtype', '', $param, '', $sortfield, $sortorder, '', $arrayfields['aa.pcg_subtype']['help']); if (!empty($arrayfields['aa.active']['checked'])) print_liste_field_titre($arrayfields['aa.active']['label'], $_SERVER["PHP_SELF"], 'aa.active', '', $param, '', $sortfield, $sortorder); print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); print "\n"; @@ -448,15 +441,6 @@ if ($resql) if (!$i) $totalarray['nbfield']++; } - // Chart of accounts subtype - if (!empty($arrayfields['aa.pcg_subtype']['checked'])) - { - print ""; - print $obj->pcg_subtype; - print "\n"; - if (!$i) $totalarray['nbfield']++; - } - // Activated or not if (!empty($arrayfields['aa.active']['checked'])) { diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index f2bc1907c7c..7449750f958 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -92,7 +92,6 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) $object->fk_pcg_version = $obj->pcg_version; $object->pcg_type = GETPOST('pcg_type', 'alpha'); - $object->pcg_subtype = GETPOST('pcg_subtype', 'alpha'); $object->account_number = $account_number; $object->account_parent = $account_parent; $object->account_category = GETPOST('account_category', 'alpha'); @@ -158,7 +157,6 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) $object->fk_pcg_version = $obj->pcg_version; $object->pcg_type = GETPOST('pcg_type', 'alpha'); - $object->pcg_subtype = GETPOST('pcg_subtype', 'alpha'); $object->account_number = $account_number; $object->account_parent = $account_parent; $object->account_category = GETPOST('account_category', 'alpha'); @@ -260,12 +258,6 @@ if ($action == 'create') { print ''; print ''; - // Chart of accounts subtype - print ''.$langs->trans("Pcgsubtype").''; - print ''; - print ''; - print ''; - print ''; dol_fiche_end(); @@ -329,12 +321,6 @@ elseif ($id > 0 || $ref) { print ''; print ''; - // Chart of accounts subtype - print ''.$langs->trans("Pcgsubtype").''; - print ''; - print ''; - print ''; - print ''; dol_fiche_end(); @@ -383,10 +369,6 @@ elseif ($id > 0 || $ref) { print ''.$langs->trans("Pcgtype").''; print ''.$object->pcg_type.''; - // Chart of accounts subtype - print ''.$langs->trans("Pcgsubtype").''; - print ''.$object->pcg_subtype.''; - print ''; print ''; diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index f04f17c6e8c..50cf04a490a 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -677,9 +677,6 @@ if ($id) } if ($fieldlist[$field] == 'pcg_type') { $valuetoshow = $langs->trans("Pcg_type"); - } - if ($fieldlist[$field] == 'pcg_subtype') { - $valuetoshow = $langs->trans("Pcg_subtype"); } if ($fieldlist[$field] == 'type_template') { $valuetoshow = $langs->trans("TypeOfTemplate"); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index bd5b780a0b6..9b6ad2fbbb0 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -29,6 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountancyexport.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/bookkeeping.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaccounting.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; @@ -538,6 +539,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { */ $formother = new FormOther($db); +$formfile = new FormFile($db); $title_page = $langs->trans("Bookkeeping"); @@ -914,7 +916,69 @@ while ($i < min($num, $limit)) // Document ref if (!empty($arrayfields['t.doc_ref']['checked'])) { - print ''.$line->doc_ref.''; + if ($line->doc_type == 'customer_invoice') + { + $langs->loadLangs(array('bills')); + + require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $objectstatic = new Facture($db); + $objectstatic->fetch($line->fk_doc); + //$modulepart = 'facture'; + + $filename = dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->facture->dir_output.'/'.dol_sanitizeFileName($line->doc_ref); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + } + elseif ($line->doc_type == 'supplier_invoice') + { + $langs->loadLangs(array('bills')); + + require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; + $objectstatic = new FactureFournisseur($db); + $objectstatic->fetch($line->fk_doc); + //$modulepart = 'invoice_supplier'; + + $filename = dol_sanitizeFileName($line->doc_ref); + $filedir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($line->fk_doc, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); + $subdir = get_exdir($objectstatic->id, 2, 0, 0, $objectstatic, $modulepart).dol_sanitizeFileName($line->doc_ref); + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $subdir, $filedir); + } + elseif ($line->doc_type == 'expense_report') + { + $langs->loadLangs(array('trips')); + + require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + $objectstatic = new ExpenseReport($db); + $objectstatic->fetch($line->fk_doc); + //$modulepart = 'expensereport'; + + $filename=dol_sanitizeFileName($line->doc_ref); + $filedir=$conf->expensereport->dir_output . '/' . dol_sanitizeFileName($line->doc_ref); + $urlsource=$_SERVER['PHP_SELF'].'?id='.$objectstatic->id; + $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); + } + else + { + // Other type + } + + print ''; + + print ''; + // Picto + Ref + print '
'; + + if($line->doc_type == 'customer_invoice' || $line->doc_type == 'supplier_invoice' || $line->doc_type == 'expense_report') + { + print $objectstatic->getNomUrl(1, '', 0, 0, '', 0, -1, 1); + print $documentlink; + } else { + print $line->doc_ref; + } + print '
'; + + print "\n"; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index c59e87dfd93..02d5f0bb183 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -53,11 +53,6 @@ class AccountancySystem */ public $pcg_type; - /** - * @var string pcg subtype - */ - public $pcg_subtype; - /** * @var string Accountancy System numero */ diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 1fc953af959..21f7c1cb210 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -90,11 +90,6 @@ class AccountingAccount extends CommonObject */ public $pcg_type; - /** - * @var string pcg subtype - */ - public $pcg_subtype; - /** * @var string account number */ @@ -167,7 +162,7 @@ class AccountingAccount extends CommonObject global $conf; if ($rowid || $account_number) { - $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.pcg_subtype, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active"; + $sql = "SELECT a.rowid as rowid, a.datec, a.tms, a.fk_pcg_version, a.pcg_type, a.account_number, a.account_parent, a.label, a.labelshort, a.fk_accounting_category, a.fk_user_author, a.fk_user_modif, a.active"; $sql .= ", ca.label as category_label"; $sql .= " FROM " . MAIN_DB_PREFIX . "accounting_account as a"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_accounting_category as ca ON a.fk_accounting_category = ca.rowid"; @@ -198,7 +193,6 @@ class AccountingAccount extends CommonObject $this->tms = $obj->tms; $this->fk_pcg_version = $obj->fk_pcg_version; $this->pcg_type = $obj->pcg_type; - $this->pcg_subtype = $obj->pcg_subtype; $this->account_number = $obj->account_number; $this->account_parent = $obj->account_parent; $this->label = $obj->label; @@ -240,8 +234,6 @@ class AccountingAccount extends CommonObject $this->fk_pcg_version = trim($this->fk_pcg_version); if (isset($this->pcg_type)) $this->pcg_type = trim($this->pcg_type); - if (isset($this->pcg_subtype)) - $this->pcg_subtype = trim($this->pcg_subtype); if (isset($this->account_number)) $this->account_number = trim($this->account_number); if (isset($this->label)) @@ -253,10 +245,6 @@ class AccountingAccount extends CommonObject { $this->pcg_type = 'XXXXXX'; } - if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1') - { - $this->pcg_subtype = 'XXXXXX'; - } // Check parameters // Put here code to add control on parameters values @@ -266,7 +254,6 @@ class AccountingAccount extends CommonObject $sql .= ", entity"; $sql .= ", fk_pcg_version"; $sql .= ", pcg_type"; - $sql .= ", pcg_subtype"; $sql .= ", account_number"; $sql .= ", account_parent"; $sql .= ", label"; @@ -279,7 +266,6 @@ class AccountingAccount extends CommonObject $sql .= ", " . $conf->entity; $sql .= ", " . (empty($this->fk_pcg_version) ? 'NULL' : "'" . $this->db->escape($this->fk_pcg_version) . "'"); $sql .= ", " . (empty($this->pcg_type) ? 'NULL' : "'" . $this->db->escape($this->pcg_type) . "'"); - $sql .= ", " . (empty($this->pcg_subtype) ? 'NULL' : "'" . $this->db->escape($this->pcg_subtype) . "'"); $sql .= ", " . (empty($this->account_number) ? 'NULL' : "'" . $this->db->escape($this->account_number) . "'"); $sql .= ", " . (empty($this->account_parent) ? 0 : (int) $this->account_parent); $sql .= ", " . (empty($this->label) ? "''" : "'" . $this->db->escape($this->label) . "'"); @@ -341,17 +327,12 @@ class AccountingAccount extends CommonObject { $this->pcg_type = 'XXXXXX'; } - if (empty($this->pcg_subtype) || $this->pcg_subtype == '-1') - { - $this->pcg_subtype = 'XXXXXX'; - } $this->db->begin(); $sql = "UPDATE " . MAIN_DB_PREFIX . "accounting_account "; $sql .= " SET fk_pcg_version = " . ($this->fk_pcg_version ? "'" . $this->db->escape($this->fk_pcg_version) . "'" : "null"); $sql .= " , pcg_type = " . ($this->pcg_type ? "'" . $this->db->escape($this->pcg_type) . "'" : "null"); - $sql .= " , pcg_subtype = " . ($this->pcg_subtype ? "'" . $this->db->escape($this->pcg_subtype) . "'" : "null"); $sql .= " , account_number = '" . $this->db->escape($this->account_number) . "'"; $sql .= " , account_parent = " . (int) $this->account_parent; $sql .= " , label = " . ($this->label ? "'" . $this->db->escape($this->label) . "'" : "''"); diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 8372a728cd2..d849496d965 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -760,7 +760,7 @@ if (! $error && $action == 'writebookkeeping') { } } - if (price2num($totaldebit) != price2num($totalcredit)) + if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')) { $error++; $errorforline++; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 1fbed52b9e3..29131274c7a 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -355,7 +355,7 @@ if ($action == 'writebookkeeping') { } // Protection against a bug on line before - if (price2num($totaldebit) != price2num($totalcredit)) + if (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT')) { $error++; $errorforline++; diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 4d4368ede62..c7fb4c06304 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -513,7 +513,7 @@ if ($action == 'writebookkeeping') { } // Protection against a bug on lines before - if (!$errorforline && (price2num($totaldebit) != price2num($totalcredit))) + if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))) { $error++; $errorforline++; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 6043d2bf857..878270d3687 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -471,7 +471,7 @@ if ($action == 'writebookkeeping') { } // Protection against a bug on lines before - if (!$errorforline && (price2num($totaldebit) != price2num($totalcredit))) + if (! $errorforline && (price2num($totaldebit, 'MT') != price2num($totalcredit, 'MT'))) { $error++; $errorforline++; diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 9149896988d..03c4eeb66cf 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -66,7 +66,7 @@ llxHeader('', $langs->trans("ClickToDialSetup"), $wikihelp); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("ClickToDialSetup"), $linkback, 'title_setup'); -print $langs->trans("ClickToDialDesc")."
\n"; +print ''.$langs->trans("ClickToDialDesc")."
\n"; print '
'; print '
'; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index b269e83fc80..b5ec2969f39 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -414,7 +414,7 @@ print ''; print ''."\n"; // Name -print ''."\n"; // Address @@ -478,36 +478,36 @@ if (!empty($conf->barcode->enabled)) { // Logo print ''; // Logo (squarred) print ''; // Note diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index b149173904b..392e1a9e147 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -231,7 +231,9 @@ if ($action == 'confirm_collect') $form = new Form($db); $formfile = new FormFile($db); -llxHeader('', 'EmailCollector', ''); +$help_url="EN:Module_EMail_Collector|FR:Module_Collecteur_de_courrier_électronique|ES:Module_EMail_Collector"; + +llxHeader('', 'EmailCollector', $help_url); // Example : Adding jquery code print '
'.$langs->trans("CompanyInfo").''.$langs->trans("Value").'
'; +print '
'; print 'global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '' : ' autofocus="autofocus"').'>
'; -print '
'; +print '
'; print ''; -print '
'; +print '
'; if (!empty($mysoc->logo_mini)) { print ''.img_delete($langs->trans("Delete")).''; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { - print '   '; + print '
'; print ''; } } else { print ''; } -print '
'; +print ''; print '
'; -print '
'; +print '
'; print ''; -print '
'; +print '
'; if (!empty($mysoc->logo_squarred_mini)) { print ''.img_delete($langs->trans("Delete")).''; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { - print '   '; + print '
'; print ''; } } else { print ''; } -print '
'; +print ''; print '