diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 690b00211f7..02d21453a3a 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -6,7 +6,7 @@ Bug reports and feature requests *Note*: Issues are not a support forum. If you need help using the software, please use [the forums](http://www.dolibarr.org/forum). -Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/Issues). +Issues are managed on [GitHub](https://github.com/Dolibarr/dolibarr/issues). 1. Please [use the search engine](https://help.github.com/articles/searching-issues) to check if nobody's already reported your problem. 2. [Create an issue](https://help.github.com/articles/creating-an-issue). Choose an appropriate title. Prepend appropriately with Bug or Feature Request. diff --git a/README.md b/README.md index cf2de36b81d..eda6b8b642e 100644 --- a/README.md +++ b/README.md @@ -91,14 +91,15 @@ See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) - Standing orders management (European SEPA) - Bank accounts management - Shared calendar/agenda (with ical and vcal export for third party tools integration) -- Opportunities and/or project management (following project benefit including invoices, expense reports, time spent, ...) +- Opportunities and/or project management - Projects management - Contracts management - Stock management - Shipping management - Interventions management - Employee's leave requests management -- Expense report management +- Expense reports +- Timesheets - Electronic Document Management (EDM) - Foundations members management - Mass emailing diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 8f023432727..74479a9d39f 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent @@ -87,7 +87,8 @@ if ($action == 'update') { setEventMessages($langs->trans("Error"), null, 'errors'); } - foreach ($list as $constname) { + foreach ($list as $constname) + { $constvalue = GETPOST($constname, 'alpha'); if (! dolibarr_set_const($db, $constname, $constvalue, 'chaine', 0, '', $conf->entity)) { @@ -278,13 +279,17 @@ foreach ($list as $key) $var = ! $var; print ''; + + if (! empty($conf->global->ACCOUNTING_MANAGE_ZERO) && ($key == 'ACCOUNTING_LENGTH_GACCOUNT' || $key == 'ACCOUNTING_LENGTH_AACCOUNT')) continue; + // Param $label = $langs->trans($key); print ''.$label.''; // Value print ''; - print ''; + print ''; print ''; + print ''; } @@ -301,7 +306,7 @@ print '
transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("Financial").'-'.$langs->transnoentitiesnoconv("Accountancy")); +print $langs->trans("AccountancySetupDoneFromAccountancyMenu", $langs->transnoentitiesnoconv("Home").'-'.$langs->transnoentitiesnoconv("MenuFinancial").'-'.$langs->transnoentitiesnoconv("MenuAccountancy")); print '
'; print ''; diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 6778f618265..e9d38ad3776 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2012 Laurent Destailleur - * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2015 Jean-François Ferry * * 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 diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 6d9df62e979..107cffd8500 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -516,6 +516,7 @@ if ($mode == 'common') // Check filters $modulename=$objMod->getName(); + $moduletechnicalname=$objMod->name; $moduledesc=$objMod->getDesc(); $moduledesclong=$objMod->getDescLong(); $moduleauthor=$objMod->getPublisher(); @@ -525,6 +526,7 @@ if ($mode == 'common') { $qualified=0; if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) + || preg_match('/'.preg_quote($search_keyword).'/i', $moduletechnicalname) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong) || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index f8b50fb588a..25d410e7bdb 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1353,7 +1353,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print '
    '; // always 1 li per ul, 1 ul per event print '
  • '; print ''; @@ -1413,7 +1413,9 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa { $savlabel=$event->libelle; $event->libelle=$daterange; + //print ''; print $event->getNomUrl(0); + //print ''; $event->libelle=$savlabel; } else @@ -1421,7 +1423,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print $daterange; } //print ' '; - print "
    \n"; + print " "; } else { @@ -1535,14 +1537,22 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa * Change color with a delta * * @param string $color Color - * @param int $minus Delta + * @param int $minus Delta (1 = 16 unit) + * @param int $minusunit Minus unit * @return string New color */ -function dol_color_minus($color, $minus) +function dol_color_minus($color, $minus, $minusunit = 16) { $newcolor=$color; - $newcolor[0]=((hexdec($newcolor[0])-$minus)<0)?0:dechex((hexdec($newcolor[0])-$minus)); - $newcolor[2]=((hexdec($newcolor[2])-$minus)<0)?0:dechex((hexdec($newcolor[2])-$minus)); - $newcolor[4]=((hexdec($newcolor[4])-$minus)<0)?0:dechex((hexdec($newcolor[4])-$minus)); + if ($minusunit == 16) + { + $newcolor[0]=dechex(max(min(hexdec($newcolor[0])-$minus, 15), 0)); + $newcolor[2]=dechex(max(min(hexdec($newcolor[2])-$minus, 15), 0)); + $newcolor[4]=dechex(max(min(hexdec($newcolor[4])-$minus, 15), 0)); + } + else + { + // Not yet implemented + } return $newcolor; } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index ea4b21d78be..2ce6a638191 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -846,11 +846,6 @@ else print '
    '; -/* print ''; - print ''; -*/ // Description print ''; - - // Status - /* - print ''; - */ // Nb of distinct emails print ''; @@ -1191,7 +1179,7 @@ else $htmltext.=''; // Print mail content - print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic'); + print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic'); dol_fiche_head(); diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index 82269434638..cf93c87dabb 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -125,6 +125,8 @@ if ($socid > 0) print load_fiche_titre($langs->trans("NewRelativeDiscount"),'',''); + print '
    '; + print '
    '.$langs->trans("Ref").''; - print $form->showrefnav($object,'id', $linkback); - print '
    '.$form->editfieldkey("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string').''; print $form->editfieldval("MailTitle",'titre',$object->titre,$object,$user->rights->mailing->creer && $object->statut < 3,'string'); @@ -865,13 +860,6 @@ else print '
    '.$form->editfieldkey("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string').''; print $form->editfieldval("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string'); print '
    '.$langs->trans("Status").''.$object->getLibStatut(4); - if ($object->statut == 2) print ' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.')'; - print'
    '; @@ -1062,7 +1050,7 @@ else $htmltext.=''; // Print mail content - print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext), 'title_generic'); + print load_fiche_titre($langs->trans("EMail"), $form->textwithpicto($langs->trans("AvailableVariables"), $htmltext, 1, 'help', '', 0, 2, 'emailsubstitionhelp'), 'title_generic'); dol_fiche_head(''); @@ -1085,7 +1073,7 @@ else } else { - print $langs->trans("NoAttachedFiles").'
    '; + print ''.$langs->trans("NoAttachedFiles").'
    '; } print '
    '; // New value diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 92cb36059e4..76456aee99b 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2016 Frédéric France - * Copyright (C) 2016 Alexandre Spangaro + * Copyright (C) 2017 Alexandre Spangaro * * 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 @@ -28,6 +28,11 @@ require '../../main.inc.php'; 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/lib/tax.lib.php'; +if (! empty($conf->projet->enabled)) +{ + require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +} $langs->load("compta"); $langs->load("bills"); @@ -35,6 +40,7 @@ $langs->load("bills"); $id=GETPOST('id','int'); $action=GETPOST("action"); $confirm=GETPOST('confirm'); +$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); // Security check $socid = GETPOST('socid','int'); @@ -43,8 +49,6 @@ $result = restrictedArea($user, 'tax', $id, 'chargesociales','charges'); $object = new ChargeSociales($db); - - /* *************************************************************************** */ /* */ /* Actions */ @@ -122,6 +126,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer) $dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear')); $amount=price2num(GETPOST('amount')); $actioncode=GETPOST('actioncode'); + if (! $dateech) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors'); @@ -149,13 +154,14 @@ if ($action == 'add' && $user->rights->tax->charges->creer) } else { - $object->type=$actioncode; - $object->lib=GETPOST('label'); - $object->date_ech=$dateech; - $object->periode=$dateperiod; - $object->amount=$amount; - $object->mode_reglement_id = GETPOST('mode_reglement_id'); - $object->fk_account = GETPOST('fk_account', 'int'); + $object->type = $actioncode; + $object->lib = GETPOST('label'); + $object->date_ech = $dateech; + $object->periode = $dateperiod; + $object->amount = $amount; + $object->mode_reglement_id = GETPOST('mode_reglement_id'); + $object->fk_account = GETPOST('fk_account', 'int'); + $object->fk_project = GETPOST('fk_project'); $id=$object->create($user); if ($id <= 0) @@ -172,6 +178,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr $dateech=dol_mktime(GETPOST('echhour'),GETPOST('echmin'),GETPOST('echsec'),GETPOST('echmonth'),GETPOST('echday'),GETPOST('echyear')); $dateperiod=dol_mktime(GETPOST('periodhour'),GETPOST('periodmin'),GETPOST('periodsec'),GETPOST('periodmonth'),GETPOST('periodday'),GETPOST('periodyear')); $amount=price2num(GETPOST('amount')); + if (! $dateech) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateDue")), null, 'errors'); @@ -196,10 +203,11 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->tax->charges->cr { $result=$object->fetch($id); - $object->lib=GETPOST('label'); - $object->date_ech=$dateech; - $object->periode=$dateperiod; - $object->amount=price2num($amount); + $object->lib = GETPOST('label'); + $object->date_ech = $dateech; + $object->periode = $dateperiod; + $object->amount = price2num($amount); + $object->fk_project = GETPOST("fk_project"); $result=$object->update($user); if ($result <= 0) @@ -325,6 +333,21 @@ if ($action == 'create') print ''; print ''; + // Project + if (! empty($conf->projet->enabled)) + { + $formproject=new FormProjets($db); + + // Associated project + $langs->load("projects"); + + print ''; + } + // Payment Mode print ''; } + // Project + if (! empty($conf->projet->enabled)){ + print ''; + } + // Mode of payment print ''; print ''; print ''; -print ''; +print ''; print ''; print '
    '.$langs->trans("Project").''; + + $numproject=$formproject->select_projects(-1, $projectid,'fk_project',0,0,1,1); + + print '
    ' . $langs->trans('PaymentMode') . ''; $form->select_types_paiements($mode_reglement_id, 'mode_reglement_id'); @@ -485,6 +508,22 @@ if ($id > 0) print '
    '.$langs->trans("AmountTTC").''.price($object->amount,0,$outputlangs,1,-1,-1,$conf->currency).'
    '; + print $langs->trans("Project"); + print ''; + if ($action == 'edit') { + $formproject=new FormProjets($db); + $numproject=$formproject->select_projects(-1,$object->fk_project,'fk_project',16,0,1,1); + } else { + $project=new Project($db); + $project->fetch($object->fk_project); + print $project->getNomUrl(1,'',1);; + } + print '
    '; print ''; + $resteapayer = $object->total_ttc - $totalpaye; $resteapayeraffiche = $resteapayer; $cssforamountpaymentcomplete = 'amountpaymentcomplete'; diff --git a/htdocs/index.php b/htdocs/index.php index 0fec7ea11d5..ee7d2ea7e04 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -158,7 +158,8 @@ if (empty($user->societe_id)) ! empty($conf->supplier_invoice->enabled) && $user->rights->fournisseur->facture->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_INVOICES_STATS), ! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposal->lire && empty($conf->global->SOCIETE_DISABLE_SUPPLIERS_PROPOSAL_STATS), ! empty($conf->projet->enabled) && $user->rights->projet->lire, - ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire + ! empty($conf->expensereport->enabled) && $user->rights->expensereport->lire, + ! empty($conf->don->enabled) && $user->rights->don->lire ); // Class file containing the method load_state_board for each line $includes=array( @@ -179,7 +180,8 @@ if (empty($user->societe_id)) DOL_DOCUMENT_ROOT."/fourn/class/fournisseur.facture.class.php", DOL_DOCUMENT_ROOT."/supplier_proposal/class/supplier_proposal.class.php", DOL_DOCUMENT_ROOT."/projet/class/project.class.php", - DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php" + DOL_DOCUMENT_ROOT."/expensereport/class/expensereport.class.php", + DOL_DOCUMENT_ROOT."/don/class/don.class.php" ); // Name class containing the method load_state_board for each line $classes=array('User', @@ -199,7 +201,8 @@ if (empty($user->societe_id)) 'FactureFournisseur', 'SupplierProposal', 'Project', - 'ExpenseReport' + 'ExpenseReport', + 'Don' ); // Cle array returned by the method load_state_board for each line $keys=array('users', @@ -219,7 +222,8 @@ if (empty($user->societe_id)) 'supplier_invoices', 'askprice', 'projects', - 'expensereports' + 'expensereports', + 'donations' ); // Dashboard Icon lines $icons=array('user', @@ -239,7 +243,8 @@ if (empty($user->societe_id)) 'bill', 'propal', 'project', - 'trip' + 'trip', + 'generic' ); // Translation keyword $titres=array("Users", @@ -259,7 +264,8 @@ if (empty($user->societe_id)) "SuppliersInvoices", "SupplierProposalShort", "Projects", - "ExpenseReports" + "ExpenseReports", + "Donations" ); // Dashboard Link lines $links=array( @@ -280,7 +286,8 @@ if (empty($user->societe_id)) DOL_URL_ROOT.'/fourn/facture/list.php', DOL_URL_ROOT.'/supplier_proposal/list.php', DOL_URL_ROOT.'/projet/list.php?mainmenu=project', - DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm' + DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm', + DOL_URL_ROOT.'/don/list.php?leftmenu=donations' ); // Translation lang files $langfile=array("users", @@ -300,7 +307,8 @@ if (empty($user->societe_id)) "bills", "supplier_proposal", "projects", - "trips" + "trips", + "donations" ); diff --git a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql index 0f8bfb4591e..6804576c9bd 100644 --- a/htdocs/install/mysql/migration/5.0.0-6.0.0.sql +++ b/htdocs/install/mysql/migration/5.0.0-6.0.0.sql @@ -117,8 +117,9 @@ ALTER TABLE llx_product_fournisseur_price ADD COLUMN default_vat_code varchar(10 ALTER TABLE llx_user ADD COLUMN model_pdf varchar(255); ALTER TABLE llx_usergroup ADD COLUMN model_pdf varchar(255); -INSERT INTO `llx_const` (`name`, `entity`, `value`, `type`, `visible`, `note`, `tms`) VALUES -('PRODUCT_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/products', 'chaine', 0, '', '2017-03-13 16:54:30'), -('CONTRACT_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/contracts', 'chaine', 0, '', '2017-03-13 13:07:27'), -('USERGROUP_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/usergroups', 'chaine', 0, '', '2017-03-10 15:25:06'), -('USER_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/users', 'chaine', 0, '', '2017-03-10 15:14:14') +INSERT INTO llx_const (name, entity, value, type, visible, note) VALUES ('PRODUCT_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/products', 'chaine', 0, ''); +INSERT INTO llx_const (name, entity, value, type, visible, note) VALUES ('CONTRACT_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/contracts', 'chaine', 0, ''); +INSERT INTO llx_const (name, entity, value, type, visible, note) VALUES ('USERGROUP_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/usergroups', 'chaine', 0, ''); +INSERT INTO llx_const (name, entity, value, type, visible, note) VALUES ('USER_ADDON_PDF_ODT_PATH', 1, 'DOL_DATA_ROOT/doctemplates/users', 'chaine', 0, ''); + +ALTER TABLE llx_chargesociales ADD COLUMN fk_projet integer DEFAULT NULL; diff --git a/htdocs/install/mysql/tables/llx_chargesociales.sql b/htdocs/install/mysql/tables/llx_chargesociales.sql index 95ab50661b6..5c07c9a74fc 100644 --- a/htdocs/install/mysql/tables/llx_chargesociales.sql +++ b/htdocs/install/mysql/tables/llx_chargesociales.sql @@ -1,6 +1,7 @@ -- ======================================================================== -- Copyright (C) 2001-2002 Rodolphe Quiedeville -- Copyright (C) 2005-2009 Regis Houssin +-- Copyright (C) 2017 Alexandre Spangaro -- -- 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 @@ -19,23 +20,24 @@ create table llx_chargesociales ( - rowid integer AUTO_INCREMENT PRIMARY KEY, - date_ech datetime NOT NULL, -- date echeance - libelle varchar(80) NOT NULL, - entity integer DEFAULT 1 NOT NULL, -- multi company id - tms timestamp, - date_creation datetime, -- date de creation - date_valid datetime, -- date de validation - fk_user_author integer, -- user making creation - fk_user_modif integer, -- user making last change - fk_user_valid integer, -- user validating - fk_type integer NOT NULL, - fk_account integer, -- bank account - fk_mode_reglement integer, -- mode de reglement - amount real default 0 NOT NULL, - paye smallint default 0 NOT NULL, - periode date, - import_key varchar(14) + rowid integer AUTO_INCREMENT PRIMARY KEY, + date_ech datetime NOT NULL, -- date echeance + libelle varchar(80) NOT NULL, + entity integer DEFAULT 1 NOT NULL, -- multi company id + tms timestamp, + date_creation datetime, -- date de creation + date_valid datetime, -- date de validation + fk_user_author integer, -- user making creation + fk_user_modif integer, -- user making last change + fk_user_valid integer, -- user validating + fk_type integer NOT NULL, + fk_account integer, -- bank account + fk_mode_reglement integer, -- mode de reglement + amount real default 0 NOT NULL, + paye smallint default 0 NOT NULL, + periode date, + fk_projet integer DEFAULT NULL, + import_key varchar(14) )ENGINE=innodb; -- diff --git a/htdocs/langs/en_US/accountancy.lang b/htdocs/langs/en_US/accountancy.lang index f51493c2763..d8313e2a11b 100644 --- a/htdocs/langs/en_US/accountancy.lang +++ b/htdocs/langs/en_US/accountancy.lang @@ -105,9 +105,9 @@ ACCOUNTING_LIST_SORT_VENTILATION_DONE=Begin the sorting of the page "Binding don ACCOUNTING_LENGTH_DESCRIPTION=Truncate product & services description in listings after x chars (Best = 50) ACCOUNTING_LENGTH_DESCRIPTION_ACCOUNT=Truncate product & services account description form in listings after x chars (Best = 50) -ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounting accounts -ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounting accounts -ACCOUNTING_MANAGE_ZERO=Manage the zero at the end of an accounting account. Needed by some countries. Disabled by default. If set to on, you must also set the 2 following parameters (or it is ignored) +ACCOUNTING_LENGTH_GACCOUNT=Length of the general accounting accounts (If you set value to 6 here, the account '706' will appear like '706000' on screen) +ACCOUNTING_LENGTH_AACCOUNT=Length of the third party accounting accounts (If you set value to 6 here, the account '401' will appear like '401000' on screen) +ACCOUNTING_MANAGE_ZERO=Allow to manage different number of zero at the end of an accounting account. Needed by some countries (like switzerland). If keep to off (default), you can set the 2 following parameters to ask application to add virtual zero. BANK_DISABLE_DIRECT_INPUT=Disable direct recording of transaction in bank account ACCOUNTING_SELL_JOURNAL=Sell journal diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index baa0b6872f4..a608875a752 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -13,7 +13,7 @@ MenuNewPrivateIndividual=New private individual NewCompany=New company (prospect, customer, supplier) NewThirdParty=New third party (prospect, customer, supplier) CreateDolibarrThirdPartySupplier=Create a third party (supplier) -CreateThirdPartyOnly=Create thirdpary +CreateThirdPartyOnly=Create third party CreateThirdPartyAndContact=Create a third party + a child contact ProspectionArea=Prospection area IdThirdParty=Id third party diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index eca26d337c2..aa5f2195a56 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -56,6 +56,7 @@ MenuTaxAndDividends=Taxes and dividends MenuSocialContributions=Social/fiscal taxes MenuNewSocialContribution=New social/fiscal tax NewSocialContribution=New social/fiscal tax +AddSocialContribution=Add social/fiscal tax ContributionsToPay=Social/fiscal taxes to pay AccountancyTreasuryArea=Accountancy/Treasury area NewPayment=New payment @@ -205,3 +206,4 @@ ImportDataset_tax_contrib=Social/fiscal taxes ImportDataset_tax_vat=Vat payments ErrorBankAccountNotFound=Error: Bank account not found FiscalPeriod=Accounting period +ListSocialContributionAssociatedProject=List of social contributions associated with the project diff --git a/htdocs/langs/en_US/loan.lang b/htdocs/langs/en_US/loan.lang index b45a70dff72..927aab2abf4 100644 --- a/htdocs/langs/en_US/loan.lang +++ b/htdocs/langs/en_US/loan.lang @@ -44,6 +44,7 @@ GoToInterest=%s will go towards INTEREST GoToPrincipal=%s will go towards PRINCIPAL YouWillSpend=You will spend %s in year %s ListLoanAssociatedProject=List of loan associated with the project +AddLoan=Create loan # Admin ConfigLoan=Configuration of the module loan LOAN_ACCOUNTING_ACCOUNT_CAPITAL=Accounting account capital by default diff --git a/htdocs/langs/en_US/stocks.lang b/htdocs/langs/en_US/stocks.lang index 88bc6d834aa..7d23700f983 100644 --- a/htdocs/langs/en_US/stocks.lang +++ b/htdocs/langs/en_US/stocks.lang @@ -62,16 +62,19 @@ DeStockOnShipment=Decrease real stocks on shipping validation DeStockOnShipmentOnClosing=Decrease real stocks on shipping classification closed ReStockOnBill=Increase real stocks on suppliers invoices/credit notes validation ReStockOnValidateOrder=Increase real stocks on suppliers orders approbation -ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouses, after supplier order receiving +ReStockOnDispatchOrder=Increase real stocks on manual dispatching into warehouses, after supplier order receipt of goods OrderStatusNotReadyToDispatch=Order has not yet or no more a status that allows dispatching of products in stock warehouses. -StockDiffPhysicTeoric=Explanation for difference between physical and theoretical stock +StockDiffPhysicTeoric=Explanation for difference between physical and virtual stock NoPredefinedProductToDispatch=No predefined products for this object. So no dispatching in stock is required. DispatchVerb=Dispatch StockLimitShort=Limit for alert StockLimit=Stock limit for alert PhysicalStock=Physical stock RealStock=Real Stock +RealStockDesc=Physical or real stock is the stock you currently have into your internal warehouses/emplacements. +RealStockWillAutomaticallyWhen=The real stock will automatically change according to this rules (see stock module setup to change this): VirtualStock=Virtual stock +VirtualStockDesc=Virtual stock is the stock you will get once all opened pending actions that affect stocks will be closed (supplier order received, customer order shipped, ...) IdWarehouse=Id warehouse DescWareHouse=Description warehouse LieuWareHouse=Localisation warehouse diff --git a/htdocs/product/reassortlot.php b/htdocs/product/reassortlot.php index 471aa7e3e6d..01285f09417 100644 --- a/htdocs/product/reassortlot.php +++ b/htdocs/product/reassortlot.php @@ -126,10 +126,7 @@ $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product_lot as pl on pl.fk_product = p.rowi if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp"; $sql.= " WHERE p.entity IN (".getEntity('product', 1).")"; if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ -if ($sall) -{ - $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')"; -} +if ($sall) $sql.=natural_search(array('p.ref','p.label','p.description','p.note'), $sall); // if the type is not 1, we show all products (type = 0,2,3) if (dol_strlen($type)) { @@ -163,6 +160,12 @@ $sql.= " pb.batch, pb.eatby, pb.sellby,"; $sql.= " pl.eatby, pl.sellby"; if ($toolowstock) $sql.= " HAVING SUM(".$db->ifsql('ps.reel IS NULL', '0', 'ps.reel').") < p.seuil_stock_alerte"; // Not used yet $sql.= $db->order($sortfield,$sortorder); +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} $sql.= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -193,11 +196,11 @@ if ($resql) if ($sref || $snom || $sall || GETPOST('search')) { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, 0, 'title_products'); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=".$sref."&snom=".$snom."&sall=".$sall."&tosell=".$tosell."&tobuy=".$tobuy, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products'); } else { - print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num, 0, 'title_products'); + print_barre_liste($texte, $page, $_SERVER["PHP_SELF"], "&sref=$sref&snom=$snom&fourn_id=$fourn_id".(isset($type)?"&type=$type":""), $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_products'); } if (! empty($catid)) diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index e6631d4b716..c90af069fda 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -277,7 +277,7 @@ class MouvementStock extends CommonObject // Check if stock is enough when qty is < 0 // Note that qty should be > 0 with type 0 or 3, < 0 with type 1 or 2. - if ($qty < 0 && empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) + if ($movestock && $qty < 0 && empty($conf->global->STOCK_ALLOW_NEGATIVE_TRANSFER)) { if (! empty($conf->productbatch->enabled) && $product->hasbatch() && ! $skip_batch) { @@ -292,6 +292,7 @@ class MouvementStock extends CommonObject } if (! $foundforbatch || $qtyisnotenough) { + $langs->load("stocks"); $this->error = $langs->trans('qtyToTranferLotIsNotEnough'); $this->errors[] = $langs->trans('qtyToTranferLotIsNotEnough'); $this->db->rollback(); @@ -302,6 +303,7 @@ class MouvementStock extends CommonObject { if (empty($product->stock_warehouse[$entrepot_id]->real) || $product->stock_warehouse[$entrepot_id]->real < abs($qty)) { + $langs->load("stocks"); $this->error = $langs->trans('qtyToTranferIsNotEnough'); $this->errors[] = $langs->trans('qtyToTranferIsNotEnough'); $this->db->rollback(); diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 0d92afe96e0..f28f3fd00d3 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -438,6 +438,35 @@ class Productlot extends CommonObject } } + + /** + * Return label of status of object + * + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label of status + */ + function getLibStatut($mode=0) + { + return $this->LibStatut(0,$mode); + } + + /** + * Return label of a given status + * + * @param int $statut Status + * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto + * @return string Label of status + */ + function LibStatut($statut,$mode=0) + { + global $langs; + + //$langs->load('stocks'); + + return ''; + } + + /** * Return a link to the a lot card (with optionaly the picto) * Use this->id,this->lastname, this->firstname diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index d23dca08282..d2ba81db86c 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -95,7 +95,7 @@ $arrayfields=array( 'm.batch'=>array('label'=>$langs->trans("BatchNumberShort"), 'checked'=>1, 'enabled'=>(! empty($conf->productbatch->enabled))), 'pl.eatby'=>array('label'=>$langs->trans("EatByDate"), 'checked'=>0, 'enabled'=>(! empty($conf->productbatch->enabled))), 'pl.sellby'=>array('label'=>$langs->trans("SellByDate"), 'checked'=>0, 'position'=>10, 'enabled'=>(! empty($conf->productbatch->enabled))), - 'm.warehouse'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it + 'e.label'=>array('label'=>$langs->trans("Warehouse"), 'checked'=>1, 'enabled'=>(! $id > 0)), // If we are on specific warehouse, we hide it 'm.fk_user_author'=>array('label'=>$langs->trans("Author"), 'checked'=>0), 'm.inventorycode'=>array('label'=>$langs->trans("InventoryCodeShort"), 'checked'=>1), 'm.label'=>array('label'=>$langs->trans("LabelMovement"), 'checked'=>1), @@ -665,6 +665,7 @@ if ($resql) if ($search_inventorycode) $param.='&search_inventorycode='.urlencode($search_inventorycode); if ($search_product_ref) $param.='&search_product_ref='.urlencode($search_product_ref); if ($search_product) $param.='&search_product='.urlencode($search_product); + if ($search_batch) $param.='&search_batch='.urlencode($search_batch); if ($search_warehouse > 0) $param.='&search_warehouse='.urlencode($search_warehouse); if (!empty($sref)) $param.='&sref='.urlencode($sref); // FIXME $sref is not defined if (!empty($snom)) $param.='&snom='.urlencode($snom); // FIXME $snom is not defined @@ -735,7 +736,7 @@ if ($resql) if (! empty($arrayfields['m.batch']['checked'])) print_liste_field_titre($arrayfields['m.batch']['label'],$_SERVER["PHP_SELF"],'m.batch','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['pl.eatby']['checked'])) print_liste_field_titre($arrayfields['pl.eatby']['label'],$_SERVER["PHP_SELF"],'pl.eatby','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['pl.sellby']['checked'])) print_liste_field_titre($arrayfields['pl.sellby']['label'],$_SERVER["PHP_SELF"],'pl.sellby','',$param,'align="center"',$sortfield,$sortorder); - if (! empty($arrayfields['m.warehouse']['checked'])) print_liste_field_titre($arrayfields['m.warehouse']['label'],$_SERVER["PHP_SELF"], "","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible + if (! empty($arrayfields['e.label']['checked'])) print_liste_field_titre($arrayfields['e.label']['label'],$_SERVER["PHP_SELF"], "e.label","",$param,"",$sortfield,$sortorder); // We are on a specific warehouse card, no filter on other should be possible if (! empty($arrayfields['m.fk_user_author']['checked'])) print_liste_field_titre($arrayfields['m.fk_user_author']['label'],$_SERVER["PHP_SELF"], "m.fk_user_author","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['m.inventorycode']['checked'])) print_liste_field_titre($arrayfields['m.inventorycode']['label'],$_SERVER["PHP_SELF"], "m.inventorycode","",$param,"",$sortfield,$sortorder); if (! empty($arrayfields['m.label']['checked'])) print_liste_field_titre($arrayfields['m.label']['label'],$_SERVER["PHP_SELF"], "m.label","",$param,"",$sortfield,$sortorder); @@ -799,7 +800,7 @@ if ($resql) // Batch if (! empty($arrayfields['m.batch']['checked'])) { - print ''; + print ''; } if (! empty($arrayfields['pl.eatby']['checked'])) { @@ -812,7 +813,7 @@ if ($resql) print ''; } // Warehouse - if (! empty($arrayfields['m.warehouse']['checked'])) + if (! empty($arrayfields['e.label']['checked'])) { print ''; } // Warehouse - if (! empty($arrayfields['m.warehouse']['checked'])) + if (! empty($arrayfields['e.label']['checked'])) { print ''; // Real stock - $text_stock_options = ''; + $text_stock_options = $langs->trans("RealStockDesc").'
    '; + $text_stock_options.= $langs->trans("RealStockWillAutomaticallyWhen").'
    '; $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || ! empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)?$langs->trans("DeStockOnShipment").'
    ':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)?$langs->trans("DeStockOnValidateOrder").'
    ':''); $text_stock_options.= (! empty($conf->global->STOCK_CALCULATE_ON_BILL)?$langs->trans("DeStockOnBill").'
    ':''); @@ -642,57 +643,55 @@ if ($id > 0 || $ref) $stocktheo = price2num($object->stock_theorique, 'MS'); + $found=0; + $helpondiff=''.$langs->trans("StockDiffPhysicTeoric").':
    '; + // Number of customer orders running + if (! empty($conf->commande->enabled)) + { + if ($found) $helpondiff.='
    '; else $found=1; + $helpondiff.=$langs->trans("ProductQtyInCustomersOrdersRunning").': '.$object->stats_commande['qty']; + $result=$object->load_stats_commande(0,'0'); + if ($result < 0) dol_print_error($db,$object->error); + $helpondiff.=' ('.$langs->trans("ProductQtyInDraft").': '.$object->stats_commande['qty'].')'; + } + + // Number of product from customer order already sent (partial shipping) + if (! empty($conf->expedition->enabled)) + { + if ($found) $helpondiff.='
    '; else $found=1; + $result=$object->load_stats_sending(0,'2'); + $helpondiff.=$langs->trans("ProductQtyInShipmentAlreadySent").': '.$object->stats_expedition['qty']; + } + + // Number of supplier order running + if (! empty($conf->fournisseur->enabled)) + { + if ($found) $helpondiff.='
    '; else $found=1; + $result=$object->load_stats_commande_fournisseur(0,'3,4'); + $helpondiff.=$langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$object->stats_commande_fournisseur['qty']; + $result=$object->load_stats_commande_fournisseur(0,'0,1,2'); + if ($result < 0) dol_print_error($db,$object->error); + $helpondiff.=' ('.$langs->trans("ProductQtyInDraftOrWaitingApproved").': '.$object->stats_commande_fournisseur['qty'].')'; + } + + // Number of product from supplier order already received (partial receipt) + if (! empty($conf->fournisseur->enabled)) + { + if ($found) $helpondiff.='
    '; else $found=1; + $helpondiff.=$langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty']; + } + // Calculating a theorical value - print ''; - print "'; + print "'; print ''; - print ''; - print ''; - // Last movement $sql = "SELECT max(m.datem) as datem"; $sql.= " FROM ".MAIN_DB_PREFIX."stock_mouvement as m"; diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 3407c75a6f5..4d1b82307f8 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -270,24 +270,6 @@ llxHeader('','ProductLot',''); $form=new Form($db); -// Put here content of your page - -// Example : Adding jquery code -print ''; - - // Part to create if ($action == 'create') { @@ -335,19 +317,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $formconfirm; } - print '
    '; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 61546b39061..dae1fe109ca 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2002 Rodolphe Quiedeville * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2016 Frédéric France + * Copyright (C) 2017 Alexandre Spangaro * * 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 @@ -52,6 +53,7 @@ class ChargeSociales extends CommonObject var $date_modification; var $date_validation; var $fk_account; + var $fk_project; /** @@ -75,7 +77,7 @@ class ChargeSociales extends CommonObject function fetch($id, $ref='') { $sql = "SELECT cs.rowid, cs.date_ech"; - $sql.= ", cs.libelle as lib, cs.fk_type, cs.amount, cs.paye, cs.periode, cs.import_key"; + $sql.= ", cs.libelle as lib, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; $sql.= ", cs.fk_account, cs.fk_mode_reglement"; $sql.= ", c.libelle"; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; @@ -93,20 +95,21 @@ class ChargeSociales extends CommonObject { $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->ref = $obj->rowid; - $this->date_ech = $this->db->jdate($obj->date_ech); - $this->lib = $obj->lib; - $this->type = $obj->fk_type; - $this->type_libelle = $obj->libelle; - $this->fk_account = $obj->fk_account; - $this->mode_reglement_id = $obj->fk_mode_reglement; - $this->mode_reglement_code = $obj->mode_reglement_code; - $this->mode_reglement = $obj->mode_reglement_libelle; - $this->amount = $obj->amount; - $this->paye = $obj->paye; - $this->periode = $this->db->jdate($obj->periode); - $this->import_key = $this->import_key; + $this->id = $obj->rowid; + $this->ref = $obj->rowid; + $this->date_ech = $this->db->jdate($obj->date_ech); + $this->lib = $obj->lib; + $this->type = $obj->fk_type; + $this->type_libelle = $obj->libelle; + $this->fk_account = $obj->fk_account; + $this->mode_reglement_id = $obj->fk_mode_reglement; + $this->mode_reglement_code = $obj->mode_reglement_code; + $this->mode_reglement = $obj->mode_reglement_libelle; + $this->amount = $obj->amount; + $this->fk_project = $obj->fk_project; + $this->paye = $obj->paye; + $this->periode = $this->db->jdate($obj->periode); + $this->import_key = $this->import_key; $this->db->free($resql); @@ -166,13 +169,15 @@ class ChargeSociales extends CommonObject $this->db->begin(); - $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, entity, fk_user_author, date_creation)"; + $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, date_creation)"; $sql.= " VALUES (".$this->type; $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); $sql.= ", ".($this->mode_reglement_id>0?"'".$this->mode_reglement_id."'":"NULL"); $sql.= ", '".$this->db->escape($this->lib)."'"; - $sql.= ", '".$this->db->idate($this->date_ech)."','".$this->db->idate($this->periode)."'"; + $sql.= ", '".$this->db->idate($this->date_ech)."'"; + $sql.= ", '".$this->db->idate($this->periode)."'"; $sql.= ", '".price2num($newamount)."'"; + $sql.= ", ".($this->fk_project>0?$this->fk_project:'NULL'); $sql.= ", ".$conf->entity; $sql.= ", ".$user->id; $sql.= ", '".$this->db->idate($now)."'"; @@ -283,6 +288,7 @@ class ChargeSociales extends CommonObject $sql.= ", date_ech='".$this->db->idate($this->date_ech)."'"; $sql.= ", periode='".$this->db->idate($this->periode)."'"; $sql.= ", amount='".price2num($this->amount,'MT')."'"; + $sql.= ", fk_projet='".$this->db->escape($this->fk_project)."'"; $sql.= ", fk_user_modif=".$user->id; $sql.= " WHERE rowid=".$this->id; @@ -302,7 +308,7 @@ class ChargeSociales extends CommonObject } /** - * Enter description here ... + * Calculate amount remaining to pay by year * * @param int $year Year * @return number diff --git a/htdocs/core/ajax/box.php b/htdocs/core/ajax/box.php index be4d9231c5f..7826747769b 100644 --- a/htdocs/core/ajax/box.php +++ b/htdocs/core/ajax/box.php @@ -73,7 +73,10 @@ if ($boxorder && $zone != '' && $userid > 0) if ($result > 0) { $langs->load("boxes"); - setEventMessages($langs->trans("BoxAdded"), null); + if (! GETPOST('closing')) + { + setEventMessages($langs->trans("BoxAdded"), null); + } } } diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index c406ada6fa5..b6d38d17b53 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -110,14 +110,14 @@ class box_actions extends ModeleBoxes $label = empty($objp->label)?$objp->type_label:$objp->label; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $actionstatic->getNomUrl(1), 'text2'=> $late, 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => ($societestatic->id > 0 ? $societestatic->getNomUrl(1) : ''), 'asis' => 1, ); @@ -128,7 +128,7 @@ class box_actions extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => ($objp->percentage>= 0?$objp->percentage.'%':''), ); @@ -149,7 +149,7 @@ class box_actions extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 34666507488..96a451f70f8 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -148,19 +148,19 @@ class box_activity extends ModeleBoxes ); $this->info_box_contents[$line][1] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(1,$data[$j]->fk_statut,0)." ".$data[$j]->annee, ); $this->info_box_contents[$line][2] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(1,$data[$j]->fk_statut,0), 'text' => $data[$j]->nb, 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", ); $this->info_box_contents[$line][3] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency) ); @@ -230,19 +230,19 @@ class box_activity extends ModeleBoxes ); $this->info_box_contents[$line][1] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut(0,$data[$j]->fk_statut,0), ); $this->info_box_contents[$line][2] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans('Bills').' '.$facturestatic->LibStatut(0,$data[$j]->fk_statut,0), 'url' => DOL_URL_ROOT."/compta/facture/list.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills", ); $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency), ); $totalMnt += $objp->Mnttot; @@ -260,7 +260,7 @@ class box_activity extends ModeleBoxes ); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); } @@ -323,12 +323,12 @@ class box_activity extends ModeleBoxes ); $this->info_box_contents[$line][1] = array( - 'td' => 'align="left"', + 'td' => '', 'text' =>$langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0), ); $this->info_box_contents[$line][2] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans("Orders")." ".$commandestatic->LibStatut($data[$j]->fk_statut,0,0), 'url' => DOL_URL_ROOT."/commande/list.php?mainmenu=commercial&leftmenu=orders&viewstatut=".$data[$j]->fk_statut, @@ -336,7 +336,7 @@ class box_activity extends ModeleBoxes $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency), ); $totalMnt += $data[$j]->Mnttot; @@ -413,12 +413,12 @@ class box_activity extends ModeleBoxes ); $this->info_box_contents[$line][1] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), ); $this->info_box_contents[$line][2] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => $data[$j]->nb, 'tooltip' => $langs->trans("Proposals")." ".$propalstatic->LibStatut($data[$j]->fk_statut,0), 'url' => DOL_URL_ROOT."/comm/propal/list.php?mainmenu=commercial&leftmenu=propals&viewstatut=".$data[$j]->fk_statut, @@ -426,7 +426,7 @@ class box_activity extends ModeleBoxes $totalnb += $data[$j]->nb; $this->info_box_contents[$line][3] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($data[$j]->Mnttot,1,$langs,0,0,-1,$conf->currency), ); $totalMnt += $data[$j]->Mnttot; diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index e99a0b30387..b6df56f52a2 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -94,7 +94,7 @@ class box_bookmarks extends ModeleBoxes 'target' => $objp->target?'newtab':'', ); $this->info_box_contents[$line][1] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $objp->title, 'url' => $objp->url, 'tooltip' => $objp->title, @@ -117,7 +117,7 @@ class box_bookmarks extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 307dcc7cbfd..0649d43a049 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -117,13 +117,13 @@ class box_clients extends ModeleBoxes $thirdpartystatic->logo = $objp->logo; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $thirdpartystatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($datem, "day") ); @@ -140,7 +140,7 @@ class box_clients extends ModeleBoxes $db->free($result); } else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql)); } diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 7653206333d..fe460f7d512 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -115,33 +115,33 @@ class box_commandes extends ModeleBoxes $societestatic->logo = $objp->logo; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $commandestatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $societestatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); if (! empty($conf->global->ORDER_BOX_LAST_ORDERS_SHOW_VALIDATE_USER)) { if ($objp->fk_user_valid > 0) $userstatic->fetch($objp->fk_user_valid); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => (($objp->fk_user_valid > 0)?$userstatic->getNomUrl(1):''), 'asis' => 1, ); } $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($date,'day'), ); @@ -158,7 +158,7 @@ class box_commandes extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index a1c3625e78c..2372a31f035 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -111,18 +111,18 @@ class box_comptes extends ModeleBoxes $solde_total[$objp->currency_code] += $solde; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $account_static->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $objp->number, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($solde, 0, $langs, 0, -1, -1, $objp->currency_code) ); @@ -151,14 +151,14 @@ class box_comptes extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); } } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 45963af9bb1..d6c38a9fce8 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -110,19 +110,19 @@ class box_contacts extends ModeleBoxes $societestatic->fournisseur = $objp->fournisseur; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $contactstatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => ($objp->fk_soc > 0 ? $societestatic->getNomUrl(1) : ''), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($datem, "day"), ); @@ -144,7 +144,7 @@ class box_contacts extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index fe864e1df16..cd436f3eb85 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -106,25 +106,25 @@ class box_contracts extends ModeleBoxes // if ($objp->fk_statut == 1 && $dateterm < ($now - $conf->contrat->cloture->warning_delay)) { $late = img_warning($langs->trans("Late")); } $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $contractstatic->getNomUrl(1), 'text2'=> $late, 'asis'=>1 ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => 'class="tdoverflowmax100 maxwidth100onsmartphone"', 'text' => $thirdpartytmp->getNomUrl(1), 'asis'=>1 ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($datec,'day'), ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right" class="nowrap"', + 'td' => 'class="nowrap right"', 'text' => $contractstatic->getLibStatut(6), 'asis'=>1, ); @@ -141,14 +141,14 @@ class box_contracts extends ModeleBoxes $db->free($resql); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); } } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index dbe71a6ca41..71b643665b3 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -163,7 +163,7 @@ class box_external_rss extends ModeleBoxes ); $this->info_box_contents[$line][1] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $title, 'url' => $href, 'tooltip' => $tooltip, diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 22a90929a0b..b7c9dfa0e91 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -122,25 +122,25 @@ class box_factures extends ModeleBoxes } $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $facturestatic->getNomUrl(1), 'text2'=> $late, 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $societestatic->getNomUrl(1, '', 40), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($date,'day'), ); @@ -161,7 +161,7 @@ class box_factures extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); @@ -169,7 +169,7 @@ class box_factures extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index b43d9cfc47b..4f88d99bb09 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -122,32 +122,32 @@ class box_factures_fourn extends ModeleBoxes } $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $facturestatic->getNomUrl(1), 'text2'=> $late, 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $objp->ref_supplier, 'tooltip' => $langs->trans('SupplierInvoice').': '.($objp->ref?$objp->ref:$objp->facid).'
    '.$langs->trans('RefSupplier').': '.$objp->ref_supplier, 'url' => DOL_URL_ROOT."/fourn/facture/card.php?facid=".$objp->facid, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $thirdpartytmp->getNomUrl(1, 'supplier'), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($date,'day'), ); @@ -171,14 +171,14 @@ class box_factures_fourn extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); } } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->transnoentities("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 0d6bc28f077..3313b4cbd50 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -119,25 +119,25 @@ class box_factures_fourn_imp extends ModeleBoxes $tooltip = $langs->trans('SupplierInvoice') . ': ' . ($objp->ref?$objp->ref:$objp->facid) . '
    ' . $langs->trans('RefSupplier') . ': ' . $objp->ref_supplier; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $facturestatic->getNomUrl(1), 'text2'=> $late, 'asis' => 1 ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $thirdpartytmp->getNomUrl(1, '', 40), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($datelimite,'day'), ); @@ -161,14 +161,14 @@ class box_factures_fourn_imp extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); } } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 67c4d4dbfcc..6bd2e662b64 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -126,25 +126,25 @@ class box_factures_imp extends ModeleBoxes } $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $facturestatic->getNomUrl(1), 'text2'=> $late, 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $societestatic->getNomUrl(1, '', 44), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($datelimite,'day'), ); @@ -163,7 +163,7 @@ class box_factures_imp extends ModeleBoxes else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); @@ -171,7 +171,7 @@ class box_factures_imp extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index d57a2a991df..9fcd8ec6cd7 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -98,7 +98,7 @@ class box_ficheinter extends ModeleBoxes 'logo' => $this->boximg, 'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', + $this->info_box_contents[$i][1] = array('td' => '', 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some interventions have no ref 'url' => DOL_URL_ROOT."/fichinter/card.php?id=".$objp->rowid); @@ -106,11 +106,11 @@ class box_ficheinter extends ModeleBoxes 'logo' => 'company', 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - $this->info_box_contents[$i][3] = array('td' => 'align="left"', + $this->info_box_contents[$i][3] = array('td' => '', 'text' => dol_trunc($objp->name,40), 'url' => DOL_URL_ROOT."/comm/card.php?socid=".$objp->socid); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', + $this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => dol_print_date($datec,'day')); $this->info_box_contents[$i][5] = array('td' => 'align="right" class="nowrap"', @@ -127,14 +127,14 @@ class box_ficheinter extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql)); } } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', + $this->info_box_contents[0][0] = array('td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed")); } } diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index ed3680af455..432d34897d0 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -94,13 +94,13 @@ class box_fournisseurs extends ModeleBoxes $thirdpartytmp->logo = $objp->logo; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $thirdpartytmp->getNomUrl(1, '', 40), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($datem, "day"), ); @@ -120,14 +120,14 @@ class box_fournisseurs extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); } } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index 552ed92b8a3..73208b1423a 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -114,18 +114,18 @@ class box_goodcustomers extends ModeleBoxes $nbimpaye = $objp->nbfact - $objp->nbfactpaye; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $thirdpartystatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($datem, "day") ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => $nbfact.( $nbimpaye != 0 ? ' ('.$nbimpaye.')':'') ); @@ -142,7 +142,7 @@ class box_goodcustomers extends ModeleBoxes $db->free($result); } else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql)); } diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index e4639070203..d313d10b310 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -255,7 +255,7 @@ class box_graph_invoices_permonth extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', + $this->info_box_contents[0][0] = array('td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed")); } } diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 254195b42f1..ddc51aa79fe 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -252,7 +252,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', + $this->info_box_contents[0][0] = array('td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed")); } } diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 6b023b9c157..0d3077a82ce 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -253,7 +253,7 @@ class box_graph_orders_permonth extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', + $this->info_box_contents[0][0] = array('td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed")); } } diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 646f28e949c..d16bfbc0f90 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -252,7 +252,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', + $this->info_box_contents[0][0] = array('td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed")); } } diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 39fe12ed7a3..2a29cf27314 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -254,7 +254,7 @@ class box_graph_propales_permonth extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', + $this->info_box_contents[0][0] = array('td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed")); } } diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index afcbe8e68a6..1bbcec45881 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -117,19 +117,19 @@ class box_members extends ModeleBoxes } $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $memberstatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $memberstatic->getFullName($langs), 'url' => DOL_URL_ROOT."/adherents/card.php?rowid=".$objp->rowid, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($datem, "day"), ); @@ -150,7 +150,7 @@ class box_members extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 5cce3254bfb..10ec22ce5f5 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -106,13 +106,13 @@ class box_produits extends ModeleBoxes $productstatic->entity = $objp->entity; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $productstatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $objp->label, ); @@ -139,7 +139,7 @@ class box_produits extends ModeleBoxes } } $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => $price, ); @@ -149,7 +149,7 @@ class box_produits extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($datem,'day'), ); @@ -174,14 +174,14 @@ class box_produits extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); } } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 3ec0fc7070c..1367caed866 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -113,13 +113,13 @@ class box_produits_alerte_stock extends ModeleBoxes $productstatic->entity = $objp->entity; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $productstatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $objp->label, ); @@ -148,7 +148,7 @@ class box_produits_alerte_stock extends ModeleBoxes } $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => $price, ); @@ -180,7 +180,7 @@ class box_produits_alerte_stock extends ModeleBoxes else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); @@ -188,7 +188,7 @@ class box_produits_alerte_stock extends ModeleBoxes } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index 4c0689cd282..c2cc1cb041b 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -104,14 +104,14 @@ class box_project extends ModeleBoxes ); $this->info_box_contents[$i][1] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $objp->ref, 'tooltip' => $tooltip, 'url' => DOL_URL_ROOT."/projet/card.php?id=".$objp->rowid, ); $this->info_box_contents[$i][2] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $objp->title, ); @@ -123,20 +123,20 @@ class box_project extends ModeleBoxes if ($resultTask) { $objTask = $db->fetch_object($resultTask); $this->info_box_contents[$i][3] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => number_format($objTask->nb, 0, ',', ' ')." ".$langs->trans("Tasks"), ); if ($objTask->nb > 0 ) $this->info_box_contents[$i][4] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => number_format(($objTask->totprogress/$objTask->nb), 0, ',', ' ')."%", ); else - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); + $this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A "); $totalnbTask += $objTask->nb; } else { - $this->info_box_contents[$i][3] = array('td' => 'align="right"', 'text' => number_format(0, 0, ',', ' ')); - $this->info_box_contents[$i][4] = array('td' => 'align="right"', 'text' => "N/A "); + $this->info_box_contents[$i][3] = array('td' => 'class="right"', 'text' => number_format(0, 0, ',', ' ')); + $this->info_box_contents[$i][4] = array('td' => 'class="right"', 'text' => "N/A "); } $i++; diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index b0a1e4a3798..d3945ddb940 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -109,25 +109,25 @@ class box_propales extends ModeleBoxes } $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $propalstatic->getNomUrl(1), 'text2'=> $late, 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $societestatic->getNomUrl(1,'',40), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($date,'day'), ); @@ -148,14 +148,14 @@ class box_propales extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); } } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index 40adb98b405..1acd77addfc 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -117,13 +117,13 @@ class box_prospect extends ModeleBoxes $thirdpartystatic->logo = $objp->logo; $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $thirdpartystatic->getNomUrl(1), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($datem, "day"), ); @@ -149,14 +149,14 @@ class box_prospect extends ModeleBoxes $db->free($resql); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); } } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 752509a0616..b33079d2ab0 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -155,13 +155,13 @@ class box_services_contracts extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql)); } } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', + $this->info_box_contents[0][0] = array('td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed")); } diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 90f36ef6d30..2754a4cece6 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -98,7 +98,7 @@ class box_services_expired extends ModeleBoxes 'logo' => $this->boximg, 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); - $this->info_box_contents[$i][1] = array('td' => 'align="left"', + $this->info_box_contents[$i][1] = array('td' => '', 'text' => ($objp->ref?$objp->ref:$objp->rowid), // Some contracts have no ref 'url' => DOL_URL_ROOT."/contrat/card.php?id=".$objp->rowid); @@ -114,7 +114,7 @@ class box_services_expired extends ModeleBoxes 'text' => dol_print_date($dateline,'day'), 'text2'=> $late); - $this->info_box_contents[$i][5] = array('td' => 'align="right"', + $this->info_box_contents[$i][5] = array('td' => 'class="right"', 'text' => $objp->nb_services); @@ -131,7 +131,7 @@ class box_services_expired extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array( 'td' => 'align="left"', + $this->info_box_contents[0][0] = array( 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql)); } @@ -140,7 +140,7 @@ class box_services_expired extends ModeleBoxes } else { - $this->info_box_contents[0][0] = array('td' => 'align="left"', + $this->info_box_contents[0][0] = array('td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed")); } } diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 1f0e1ece2ef..29b6009b367 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -112,25 +112,25 @@ class box_supplier_orders extends ModeleBoxes ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $objp->ref, 'tooltip' => $tooltip, 'url' => $urlo, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $thirdpartytmp->getNomUrl(1, 'supplier'), 'asis' => 1, ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => price($objp->total_ht, 0, $langs, 0, -1, -1, $conf->currency), ); $this->info_box_contents[$line][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => dol_print_date($date,'day'), ); @@ -151,7 +151,7 @@ class box_supplier_orders extends ModeleBoxes $db->free($result); } else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'maxlength'=>500, 'text' => ($db->error().' sql='.$sql), ); @@ -160,7 +160,7 @@ class box_supplier_orders extends ModeleBoxes else { $this->info_box_contents[0][0] = array( - 'td' => 'align="left"', + 'td' => '', 'text' => $langs->trans("ReadPermissionNotAllowed"), ); } diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 29dd9390597..ed02e2fc6eb 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -99,19 +99,19 @@ class box_task extends ModeleBoxes { $objp = $db->fetch_object($result); $this->info_box_contents[$i][] = array( - 'td' => 'align="left"', + 'td' => '', 'text' =>$langs->trans("Task")." ".$taskstatic->LibStatut($objp->fk_statut,0), ); $this->info_box_contents[$i][] = array( - 'td' => 'align="right"', + 'td' => 'class="right"', 'text' => $objp->nb." ".$langs->trans("Tasks"), 'url' => DOL_URL_ROOT."/projet/tasks/list.php?leftmenu=projects&viewstatut=".$objp->fk_statut, ); $totalnb += $objp->nb; - $this->info_box_contents[$i][] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5)); + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->plannedtot,'all',25200,5)); $totalplannedtot += $objp->plannedtot; - $this->info_box_contents[$i][] = array('td' => 'align="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5)); + $this->info_box_contents[$i][] = array('td' => 'class="right"', 'text' => ConvertSecondToTime($objp->durationtot,'all',25200,5)); $totaldurationtot += $objp->durationtot; $this->info_box_contents[$i][] = array('td' => 'align="right" width="18"', 'text' => $taskstatic->LibStatut($objp->fk_statut,3)); @@ -124,7 +124,7 @@ class box_task extends ModeleBoxes // Add the sum à the bottom of the boxes - $this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => 'align="left"', 'text' => $langs->trans("Total")." ".$textHead); + $this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => '', 'text' => $langs->trans("Total")." ".$textHead); $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totalplannedtot,'all',25200,5)); $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => ConvertSecondToTime($totaldurationtot,'all',25200,5)); diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 63ae7f3a02d..e3a84c80a1c 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -304,11 +304,13 @@ abstract class CommonDocGenerator $now=dol_now('gmt'); // gmt $array_other = array( - 'current_date'=>dol_print_date($now,'day','tzuser'), - 'current_datehour'=>dol_print_date($now,'dayhour','tzuser'), + // Date in default language + 'current_date'=>dol_print_date($now,'day','tzuser'), + 'current_datehour'=>dol_print_date($now,'dayhour','tzuser'), 'current_server_date'=>dol_print_date($now,'day','tzserver'), 'current_server_datehour'=>dol_print_date($now,'dayhour','tzserver'), - 'current_date_locale'=>dol_print_date($now,'day','tzuser',$outputlangs), + // Date in requested output language + 'current_date_locale'=>dol_print_date($now,'day','tzuser',$outputlangs), 'current_datehour_locale'=>dol_print_date($now,'dayhour','tzuser',$outputlangs), 'current_server_date_locale'=>dol_print_date($now,'day','tzserver',$outputlangs), 'current_server_datehour_locale'=>dol_print_date($now,'dayhour','tzserver',$outputlangs), @@ -377,6 +379,7 @@ abstract class CommonDocGenerator $array_key.'_ref_customer'=>$object->ref_client, $array_key.'_ref_supplier'=>(! empty($object->ref_fournisseur)?$object->ref_fournisseur:''), $array_key.'_source_invoice_ref'=>$invoice_source->ref, + // Dates $array_key.'_hour'=>dol_print_date($object->date,'hour'), $array_key.'_date'=>dol_print_date($object->date,'day'), $array_key.'_date_rfc'=>dol_print_date($object->date,'dayrfc'), @@ -387,6 +390,7 @@ abstract class CommonDocGenerator $array_key.'_date_validation'=>(! empty($object->date_validation)?dol_print_date($object->date_validation,'dayhour'):''), $array_key.'_date_delivery_planed'=>(! empty($object->date_livraison)?dol_print_date($object->date_livraison,'day'):''), $array_key.'_date_close'=>(! empty($object->date_cloture)?dol_print_date($object->date_cloture,'dayhour'):''), + $array_key.'_payment_mode_code'=>$object->mode_reglement_code, $array_key.'_payment_mode'=>($outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code)!='PaymentType'.$object->mode_reglement_code?$outputlangs->transnoentitiesnoconv('PaymentType'.$object->mode_reglement_code):$object->mode_reglement), $array_key.'_payment_term_code'=>$object->cond_reglement_code, @@ -471,10 +475,13 @@ abstract class CommonDocGenerator 'line_price_ht_locale'=>price($line->total_ht, 0, $outputlangs), 'line_price_ttc_locale'=>price($line->total_ttc, 0, $outputlangs), 'line_price_vat_locale'=>price($line->total_tva, 0, $outputlangs), - 'line_date_start'=>$line->date_start, - 'line_date_start_rfc'=>dol_print_date($line->date_start,'dayrfc'), - 'line_date_end'=>$line->date_end, - 'line_date_end_rfc'=>dol_print_date($line->date_end,'dayrfc') + // Dates + 'line_date_start'=>dol_print_date($line->date_start, 'day', 'tzuser'), + 'line_date_start_locale'=>dol_print_date($line->date_start, 'day', 'tzuser', $outputlangs), + 'line_date_start_rfc'=>dol_print_date($line->date_start, 'dayrfc', 'tzuser'), + 'line_date_end'=>dol_print_date($line->date_end, 'day', 'tzuser'), + 'line_date_end_locale'=>dol_print_date($line->date_end, 'day', 'tzuser', $outputlangs), + 'line_date_end_rfc'=>dol_print_date($line->date_end, 'dayrfc', 'tzuser'), ); // Retrieve extrafields diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 8e88423f754..b79c72e6336 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1231,11 +1231,11 @@ abstract class CommonObject * @param int $id To force other object id (should not be used) * @param string $format Data format ('text', 'date'). 'text' is used if not defined * @param string $id_field To force rowid field name. 'rowid' is used if not defined - * @param User|string $user Update last update fields also if user object provided + * @param User|string $fuser Update the user of last update field with this user. If not provided, current user is used except if value is 'none' * @param string $trigkey Trigger key to run (in most cases something like 'XXX_MODIFY') * @return int <0 if KO, >0 if OK */ - function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $user='', $trigkey='') + function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $fuser=null, $trigkey='') { global $user,$langs,$conf; @@ -1255,7 +1255,8 @@ abstract class CommonObject if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'"; else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value); else if ($format == 'date') $sql.= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null"); - if (is_object($user)) $sql.=", fk_user_modif = ".$user->id; + if (! empty($fuser) && is_object($fuser)) $sql.=", fk_user_modif = ".$fuser->id; + elseif (empty($fuser) || $fuser != 'none') $sql.=", fk_user_modif = ".$user->id; $sql.= " WHERE ".$id_field." = ".$id; dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG); @@ -1264,7 +1265,7 @@ abstract class CommonObject { if ($trigkey) { - $result=$this->call_trigger($trigkey, $user); // This may set this->errors + $result=$this->call_trigger($trigkey, (! empty($fuser) && is_object($fuser)) ? $fuser : $user); // This may set this->errors if ($result < 0) $error++; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 0bb01da357d..dc47dec5c41 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -447,7 +447,7 @@ class Form else $paramfortooltipimg =($extracss?' class="'.$extracss.'"':'').($extrastyle?' style="'.$extrastyle.'"':''); // Attribut to put on td text tag if ($tooltipon == 1 || $tooltipon == 3) { - $paramfortooltiptd=' class="'.$classfortooltip.' inline-block'.($extracss?' '.$extracss:'').'" style="padding: 0px;'.($extrastyle?' '.$extrastyle:'').'" '; + $paramfortooltiptd=' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss?' '.$extracss:'').'" style="padding: 0px;'.($extrastyle?' '.$extrastyle:'').'" '; if ($tooltiptrigger == '') $paramfortooltiptd.=' title="'.($noencodehtmltext?$htmltext:dol_escape_htmltag($htmltext,1)).'"'; // Attribut to put on td tag to store tooltip else $paramfortooltiptd.=' dolid="'.$tooltiptrigger.'"'; } @@ -524,7 +524,7 @@ class Form elseif ($type == 'warning') $img = img_warning($alt); else $img = img_picto($alt, $type); - return $this->textwithtooltip($text, $htmltext, 2, $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger); + return $this->textwithtooltip($text, $htmltext, ($tooltiptrigger?3:2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger); } /** @@ -5851,7 +5851,13 @@ class Form { $ret.=dol_htmlentities($object->getFullName($langs)); } + else if (in_array($object->element, array('action', 'agenda'))) + { + $ret.=$object->ref.'
    '.$object->label; + } else if ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref); + + if ($morehtmlref) { $ret.=' '.$morehtmlref; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index bcad9dbac44..5f8fe76e320 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1046,7 +1046,7 @@ class FormOther if (boxorder==\'A:A-B:B\' && closing == 1) // There is no more boxes on screen, and we are after a delete of a box so we must hide title { jQuery.ajax({ - url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.', + url: \''.DOL_URL_ROOT.'/core/ajax/box.php?closing=\'+closing+\'&boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.', async: false }); // We force reload to be sure to get all boxes into list @@ -1055,7 +1055,7 @@ class FormOther else { jQuery.ajax({ - url: \''.DOL_URL_ROOT.'/core/ajax/box.php?boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.', + url: \''.DOL_URL_ROOT.'/core/ajax/box.php?closing=\'+closing+\'&boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.', async: true }); } diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index a0e37026ff8..0a6837ecb53 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -464,7 +464,7 @@ class FormProjets if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done) $linkedtothirdparty=false; - if (! in_array($table_element, array('don','expensereport_det','expensereport','loan','stock_mouvement'))) $linkedtothirdparty=true; + if (! in_array($table_element, array('don','expensereport_det','expensereport','loan','stock_mouvement','chargesociales'))) $linkedtothirdparty=true; $sqlfilter=''; $projectkey="fk_projet"; @@ -507,6 +507,7 @@ class FormProjets $sql = 'SELECT t.rowid, t.label as ref'; $projectkey='fk_origin'; break; + case "chargesociales": default: $sql = "SELECT t.rowid, t.ref"; break; @@ -597,7 +598,7 @@ class FormProjets if ($num > 0) { $sellist = ''; - $sql = "SELECT p.rowid as id, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status"; + $sql = "SELECT p.rowid as id, p.title, p.ref, p.public, p.dateo as do, p.datee as de, p.fk_statut as status, p.fk_opp_status, p.opp_amount, p.opp_percent, p.tms as date_update, p.budget_amount"; + $sql .= ", cls.code as opp_status_code"; $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_lead_status as cls on p.fk_opp_status = cls.rowid"; $sql .= " WHERE p.fk_soc = ".$object->id; $sql .= " ORDER BY p.dateo DESC"; @@ -544,8 +547,14 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin $num = $db->num_rows($result); print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; if ($num > 0) @@ -574,9 +583,24 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin // Label print ''; // Date start - print ''; + print ''; // Date end - print ''; + print ''; + // Opp amount + print ''; + // Opp status + print ''; + // Opp percent + print ''; // Status print ''; @@ -597,7 +621,8 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin dol_print_error($db); } print "
    '.$langs->trans("Ref").''.$langs->trans("Name").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("Status").''.$langs->trans("Ref").''.$langs->trans("Name").''.$langs->trans("DateStart").''.$langs->trans("DateEnd").''.$langs->trans("OpportunityAmountShort").''.$langs->trans("OpportunityStatusShort").''.$langs->trans("OpportunityProbabilityShort").''.$langs->trans("Status").'
    '.$obj->title.''.dol_print_date($db->jdate($obj->do),"day").''.dol_print_date($db->jdate($obj->do),"day").''.dol_print_date($db->jdate($obj->de),"day").''.dol_print_date($db->jdate($obj->de),"day").''; + if ($obj->opp_status_code) + { + print price($obj->opp_amount, 1, '', 1, -1, -1, ''); + } + print ''; + if ($obj->opp_status_code) print $langs->trans("OppStatusShort".$obj->opp_status_code); + print ''; + if ($obj->opp_percent) print price($obj->opp_percent, 1, '', 1, 0).'%'; + print ''.$projecttmp->getLibStatut(5).'
    "; - + print ''; + print "
    \n"; } diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index a2d6da7bdc5..ca140fbb290 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -772,7 +772,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable } // Security: - // On interdit fichiers caches, remontees de repertoire ainsi que les pipes dans les noms de fichiers. + // We refuse cache files/dirs, upload using .. and pipes into filenames. if (preg_match('/^\./',$src_file) || preg_match('/\.\./',$src_file) || preg_match('/[<>|]/',$src_file)) { dol_syslog("Refused to deliver file ".$src_file, LOG_WARNING); @@ -845,6 +845,7 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable * @param int $nohook Disable all hooks * @param object $object Current object in use * @return boolean True if no error (file is deleted or if glob is used and there's nothing to delete), False if error + * @see dol_delete_dir */ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=null) { @@ -856,6 +857,14 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n dol_syslog("dol_delete_file file=".$file." disableglob=".$disableglob." nophperrors=".$nophperrors." nohook=".$nohook); + // Security: + // We refuse transversal using .. and pipes into filenames. + if (preg_match('/\.\./',$file) || preg_match('/[<>|]/',$file)) + { + dol_syslog("Refused to delete file ".$file, LOG_WARNING); + return False; + } + if (empty($nohook)) { $hookmanager->initHooks(array('fileslib')); @@ -943,9 +952,18 @@ function dol_delete_file($file,$disableglob=0,$nophperrors=0,$nohook=0,$object=n * @param string $dir Directory to delete * @param int $nophperrors Disable all PHP output errors * @return boolean True if success, false if error + * @see dol_delete_file */ function dol_delete_dir($dir,$nophperrors=0) { + // Security: + // We refuse transversal using .. and pipes into filenames. + if (preg_match('/\.\./',$dir) || preg_match('/[<>|]/',$dir)) + { + dol_syslog("Refused to delete dir ".$dir, LOG_WARNING); + return False; + } + $dir_osencoded=dol_osencode($dir); return ($nophperrors?@rmdir($dir_osencoded):rmdir($dir_osencoded)); } @@ -1568,141 +1586,140 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu // find the subdirectory name as the reference if (empty($refname)) $refname=basename(dirname($original_file)."/"); + $relative_original_file = $original_file; + // Wrapping for some images - if ($modulepart == 'companylogo') + if ($modulepart == 'companylogo' && !empty($conf->mycompany->dir_output)) { $accessallowed=1; $original_file=$conf->mycompany->dir_output.'/logos/'.$original_file; } // Wrapping for users photos - elseif ($modulepart == 'userphoto') + elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output)) { $accessallowed=1; $original_file=$conf->user->dir_output.'/'.$original_file; } // Wrapping for members photos - elseif ($modulepart == 'memberphoto') + elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { $accessallowed=1; $original_file=$conf->adherent->dir_output.'/'.$original_file; } // Wrapping pour les apercu factures - elseif ($modulepart == 'apercufacture') + elseif ($modulepart == 'apercufacture' && !empty($conf->facture->dir_output)) { if ($fuser->rights->facture->lire) $accessallowed=1; $original_file=$conf->facture->dir_output.'/'.$original_file; } // Wrapping pour les apercu propal - elseif ($modulepart == 'apercupropal') + elseif ($modulepart == 'apercupropal' && !empty($conf->propal->dir_output)) { if ($fuser->rights->propale->lire) $accessallowed=1; $original_file=$conf->propal->dir_output.'/'.$original_file; } // Wrapping pour les apercu commande - elseif ($modulepart == 'apercucommande') + elseif ($modulepart == 'apercucommande' && !empty($conf->commande->dir_output)) { if ($fuser->rights->commande->lire) $accessallowed=1; $original_file=$conf->commande->dir_output.'/'.$original_file; } // Wrapping pour les apercu intervention - elseif ($modulepart == 'apercufichinter') + elseif ($modulepart == 'apercufichinter' && !empty($conf->ficheinter->dir_output)) { if ($fuser->rights->ficheinter->lire) $accessallowed=1; $original_file=$conf->ficheinter->dir_output.'/'.$original_file; } // Wrapping pour les images des stats propales - elseif ($modulepart == 'propalstats') + elseif ($modulepart == 'propalstats' && !empty($conf->propal->dir_temp)) { if ($fuser->rights->propale->lire) $accessallowed=1; $original_file=$conf->propal->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats commandes - elseif ($modulepart == 'orderstats') + elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp)) { if ($fuser->rights->commande->lire) $accessallowed=1; $original_file=$conf->commande->dir_temp.'/'.$original_file; } - elseif ($modulepart == 'orderstatssupplier') + elseif ($modulepart == 'orderstatssupplier' && !empty($conf->fournisseur->dir_output)) { if ($fuser->rights->fournisseur->commande->lire) $accessallowed=1; $original_file=$conf->fournisseur->dir_output.'/commande/temp/'.$original_file; } // Wrapping pour les images des stats factures - elseif ($modulepart == 'billstats') + elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp)) { if ($fuser->rights->facture->lire) $accessallowed=1; $original_file=$conf->facture->dir_temp.'/'.$original_file; } - elseif ($modulepart == 'billstatssupplier') + elseif ($modulepart == 'billstatssupplier' && !empty($conf->fournisseur->dir_output)) { if ($fuser->rights->fournisseur->facture->lire) $accessallowed=1; $original_file=$conf->fournisseur->dir_output.'/facture/temp/'.$original_file; } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'expeditionstats') + elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp)) { if ($fuser->rights->expedition->lire) $accessallowed=1; $original_file=$conf->expedition->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'tripsexpensesstats') + elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp)) { if ($fuser->rights->deplacement->lire) $accessallowed=1; $original_file=$conf->deplacement->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'memberstats') + elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp)) { if ($fuser->rights->adherent->lire) $accessallowed=1; $original_file=$conf->adherent->dir_temp.'/'.$original_file; } // Wrapping pour les images des stats produits - elseif (preg_match('/^productstats_/i',$modulepart)) + elseif (preg_match('/^productstats_/i',$modulepart) && !empty($conf->product->dir_temp)) { if ($fuser->rights->produit->lire || $fuser->rights->service->lire) $accessallowed=1; $original_file=(!empty($conf->product->multidir_temp[$entity])?$conf->product->multidir_temp[$entity]:$conf->service->multidir_temp[$entity]).'/'.$original_file; } // Wrapping for products or services - elseif ($modulepart == 'tax') + elseif ($modulepart == 'tax' && !empty($conf->tax->dir_output)) { if ($fuser->rights->tax->charges->lire) $accessallowed=1; $original_file=$conf->tax->dir_output.'/'.$original_file; } // Wrapping for products or services - elseif ($modulepart == 'actions') + elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { if ($fuser->rights->agenda->myactions->read) $accessallowed=1; $original_file=$conf->agenda->dir_output.'/'.$original_file; } // Wrapping for categories - elseif ($modulepart == 'category') + elseif ($modulepart == 'category' && !empty($conf->categorie->dir_output)) { if ($fuser->rights->categorie->lire) $accessallowed=1; $original_file=$conf->categorie->multidir_output[$entity].'/'.$original_file; } // Wrapping pour les prelevements - elseif ($modulepart == 'prelevement') + elseif ($modulepart == 'prelevement' && !empty($conf->prelevement->dir_output)) { - if ($fuser->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file)) - { - $accessallowed=1; - } + if ($fuser->rights->prelevement->bons->lire || preg_match('/^specimen/i',$original_file)) $accessallowed=1; $original_file=$conf->prelevement->dir_output.'/'.$original_file; } // Wrapping pour les graph energie - elseif ($modulepart == 'graph_stock') + elseif ($modulepart == 'graph_stock' && !empty($conf->stock->dir_temp)) { $accessallowed=1; $original_file=$conf->stock->dir_temp.'/'.$original_file; } // Wrapping pour les graph fournisseurs - elseif ($modulepart == 'graph_fourn') + elseif ($modulepart == 'graph_fourn' && !empty($conf->fournisseur->dir_temp)) { $accessallowed=1; $original_file=$conf->fournisseur->dir_temp.'/'.$original_file; } // Wrapping pour les graph des produits - elseif ($modulepart == 'graph_product') + elseif ($modulepart == 'graph_product' && !empty($conf->product->dir_temp)) { $accessallowed=1; $original_file=$conf->product->multidir_temp[$entity].'/'.$original_file; @@ -1711,32 +1728,31 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu elseif ($modulepart == 'barcode') { $accessallowed=1; - // If viewimage is called for barcode, we try to output an image on the fly, - // with not build of file on disk. + // If viewimage is called for barcode, we try to output an image on the fly, with no build of file on disk. //$original_file=$conf->barcode->dir_temp.'/'.$original_file; $original_file=''; } // Wrapping pour les icones de background des mailings - elseif ($modulepart == 'iconmailing') + elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp)) { $accessallowed=1; $original_file=$conf->mailing->dir_temp.'/'.$original_file; } - // Wrapping pour les icones de background des mailings - elseif ($modulepart == 'scanner_user_temp') + // Wrapping pour le scanner + elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { $accessallowed=1; $original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; } // Wrapping pour les images fckeditor - elseif ($modulepart == 'fckeditor') + elseif ($modulepart == 'fckeditor' && !empty($conf->fckeditor->dir_output)) { $accessallowed=1; $original_file=$conf->fckeditor->dir_output.'/'.$original_file; } // Wrapping for third parties - else if ($modulepart == 'company' || $modulepart == 'societe') + else if (($modulepart == 'company' || $modulepart == 'societe') && !empty($conf->societe->dir_output)) { if ($fuser->rights->societe->lire || preg_match('/^specimen/i',$original_file)) { @@ -1747,7 +1763,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for contact - else if ($modulepart == 'contact') + else if ($modulepart == 'contact' && !empty($conf->societe->dir_output)) { if ($fuser->rights->societe->lire) { @@ -1757,7 +1773,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for invoices - else if ($modulepart == 'facture' || $modulepart == 'invoice') + else if (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->dir_output)) { if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file)) { @@ -1766,7 +1782,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->facture->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } - else if ($modulepart == 'massfilesarea_proposals') + else if ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->dir_output)) { if ($fuser->rights->propal->lire || preg_match('/^specimen/i',$original_file)) { @@ -1791,8 +1807,8 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->facture->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; } - // Wrapping pour les fiches intervention - else if ($modulepart == 'ficheinter') + // Wrapping for interventions + else if (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output)) { if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file)) { @@ -1803,7 +1819,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les deplacements et notes de frais - else if ($modulepart == 'deplacement') + else if ($modulepart == 'deplacement' && !empty($conf->deplacement->dir_output)) { if ($fuser->rights->deplacement->lire || preg_match('/^specimen/i',$original_file)) { @@ -1813,7 +1829,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; } // Wrapping pour les propales - else if ($modulepart == 'propal') + else if ($modulepart == 'propal' && !empty($conf->propal->dir_output)) { if ($fuser->rights->propale->lire || preg_match('/^specimen/i',$original_file)) { @@ -1825,7 +1841,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les commandes - else if ($modulepart == 'commande' || $modulepart == 'order') + else if (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->dir_output)) { if ($fuser->rights->commande->lire || preg_match('/^specimen/i',$original_file)) { @@ -1836,7 +1852,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les projets - else if ($modulepart == 'project') + else if ($modulepart == 'project' && !empty($conf->projet->dir_output)) { if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file)) { @@ -1845,7 +1861,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->projet->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project', 1).")"; } - else if ($modulepart == 'project_task') + else if ($modulepart == 'project_task' && !empty($conf->projet->dir_output)) { if ($fuser->rights->projet->lire || preg_match('/^specimen/i',$original_file)) { @@ -1854,19 +1870,9 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->projet->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project', 1).")"; } - // Wrapping for interventions - else if ($modulepart == 'fichinter') - { - if ($fuser->rights->ficheinter->lire || preg_match('/^specimen/i',$original_file)) - { - $accessallowed=1; - } - $original_file=$conf->ficheinter->dir_output.'/'.$original_file; - $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les commandes fournisseurs - else if ($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') + else if (($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') && !empty($conf->fournisseur->commande->dir_output)) { if ($fuser->rights->fournisseur->commande->lire || preg_match('/^specimen/i',$original_file)) { @@ -1877,7 +1883,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les factures fournisseurs - else if ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') + else if (($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') && !empty($conf->fournisseur->facture->dir_output)) { if ($fuser->rights->fournisseur->facture->lire || preg_match('/^specimen/i',$original_file)) { @@ -1898,7 +1904,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les rapport de paiements - else if ($modulepart == 'facture_paiement') + else if ($modulepart == 'facture_paiement' && !empty($conf->facture->dir_output)) { if ($fuser->rights->facture->lire || preg_match('/^specimen/i',$original_file)) { @@ -1909,7 +1915,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for accounting exports - else if ($modulepart == 'export_compta') + else if ($modulepart == 'export_compta' && !empty($conf->accounting->dir_output)) { if ($fuser->rights->accounting->bind->write || preg_match('/^specimen/i',$original_file)) { @@ -1919,7 +1925,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les expedition - else if ($modulepart == 'expedition') + else if ($modulepart == 'expedition' && !empty($conf->expedition->dir_output)) { if ($fuser->rights->expedition->lire || preg_match('/^specimen/i',$original_file)) { @@ -1929,7 +1935,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les bons de livraison - else if ($modulepart == 'livraison') + else if ($modulepart == 'livraison' && !empty($conf->livraison->dir_output)) { if ($fuser->rights->expedition->livraison->lire || preg_match('/^specimen/i',$original_file)) { @@ -1939,7 +1945,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les actions - else if ($modulepart == 'actions') + else if ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { if ($fuser->rights->agenda->myactions->read || preg_match('/^specimen/i',$original_file)) { @@ -1949,7 +1955,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les actions - else if ($modulepart == 'actionsreport') + else if ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp)) { if ($fuser->rights->agenda->allactions->read || preg_match('/^specimen/i',$original_file)) { @@ -1970,7 +1976,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les contrats - else if ($modulepart == 'contract') + else if ($modulepart == 'contract' && !empty($conf->contrat->dir_output)) { if ($fuser->rights->contrat->lire || preg_match('/^specimen/i',$original_file)) { @@ -1981,7 +1987,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les dons - else if ($modulepart == 'donation') + else if ($modulepart == 'donation' && !empty($conf->donation->dir_output)) { if ($fuser->rights->don->lire || preg_match('/^specimen/i',$original_file)) { @@ -1991,7 +1997,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour les remises de cheques - else if ($modulepart == 'remisecheque') + else if ($modulepart == 'remisecheque' && !empty($conf->banque->dir_output)) { if ($fuser->rights->banque->lire || preg_match('/^specimen/i',$original_file)) { @@ -2002,7 +2008,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for bank - else if ($modulepart == 'bank') + else if ($modulepart == 'bank' && !empty($conf->bank->dir_output)) { if ($fuser->rights->banque->lire) { @@ -2012,7 +2018,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for export module - else if ($modulepart == 'export') + else if ($modulepart == 'export' && !empty($conf->export->dir_temp)) { // Aucun test necessaire car on force le rep de download sur // le rep export qui est propre a l'utilisateur @@ -2021,21 +2027,21 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for import module - else if ($modulepart == 'import') + else if ($modulepart == 'import' && !empty($conf->import->dir_temp)) { $accessallowed=1; $original_file=$conf->import->dir_temp.'/'.$original_file; } // Wrapping pour l'editeur wysiwyg - else if ($modulepart == 'editor') + else if ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { $accessallowed=1; $original_file=$conf->fckeditor->dir_output.'/'.$original_file; } // Wrapping for miscellaneous medias files - elseif ($modulepart == 'medias') + elseif ($modulepart == 'medias' && !empty($dolibarr_main_data_root)) { $accessallowed=1; global $dolibarr_main_data_root; @@ -2043,25 +2049,21 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for backups - else if ($modulepart == 'systemtools') + else if ($modulepart == 'systemtools' && !empty($conf->admin->dir_output)) { - if ($fuser->admin) - { - $accessallowed=1; - } + if ($fuser->admin) $accessallowed=1; $original_file=$conf->admin->dir_output.'/'.$original_file; } // Wrapping for upload file test - else if ($modulepart == 'admin_temp') + else if ($modulepart == 'admin_temp' && !empty($conf->admin->dir_temp)) { - if ($fuser->admin) - $accessallowed=1; + if ($fuser->admin) $accessallowed=1; $original_file=$conf->admin->dir_temp.'/'.$original_file; } // Wrapping pour BitTorrent - else if ($modulepart == 'bittorrent') + else if ($modulepart == 'bittorrent' && !empty($conf->bittorrent->dir_output)) { $accessallowed=1; $dir='files'; @@ -2070,7 +2072,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping pour Foundation module - else if ($modulepart == 'member') + else if ($modulepart == 'member' && !empty($conf->adherent->dir_output)) { if ($fuser->rights->adherent->lire || preg_match('/^specimen/i',$original_file)) { @@ -2080,7 +2082,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } // Wrapping for Scanner - else if ($modulepart == 'scanner_user_temp') + else if ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { $accessallowed=1; $original_file=$conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; @@ -2093,20 +2095,38 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu // If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart else { + if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a file called specimen. Test must be done before changing $original_file int full path. + if ($fuser->admin) $accessallowed=1; // If user is admin + // Define $accessallowed if (preg_match('/^([a-z]+)_user_temp$/i',$modulepart,$reg)) { - if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; + if (empty($conf->{$reg[1]}->dir_temp)) // modulepart not supported + { + dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')'); + exit; + } + if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; $original_file=$conf->{$reg[1]}->dir_temp.'/'.$fuser->id.'/'.$original_file; } else if (preg_match('/^([a-z]+)_temp$/i',$modulepart,$reg)) { - if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; + if (empty($conf->{$reg[1]}->dir_temp)) // modulepart not supported + { + dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')'); + exit; + } + if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; $original_file=$conf->{$reg[1]}->dir_temp.'/'.$original_file; } else if (preg_match('/^([a-z]+)_user$/i',$modulepart,$reg)) { - if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; + if (empty($conf->{$reg[1]}->dir_output)) // modulepart not supported + { + dol_print_error('','Error call dol_check_secure_access_document with not supported value for modulepart parameter ('.$modulepart.')'); + exit; + } + if ($fuser->rights->{$reg[1]}->lire || $fuser->rights->{$reg[1]}->read || ($fuser->rights->{$reg[1]}->download)) $accessallowed=1; $original_file=$conf->{$reg[1]}->dir_output.'/'.$fuser->id.'/'.$original_file; } else @@ -2130,8 +2150,6 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu $original_file=$conf->$modulepart->dir_output.'/'.$original_file; } } - if (preg_match('/^specimen/i',$original_file)) $accessallowed=1; // If link to a specimen - if ($fuser->admin) $accessallowed=1; // If user is admin // For modules who wants to manage different levels of permissions for documents $subPermCategoryConstName = strtoupper($modulepart).'_SUBPERMCATEGORY_FOR_DOCUMENTS'; @@ -2163,7 +2181,7 @@ function dol_check_secure_access_document($modulepart,$original_file,$entity,$fu } /** - * Store object in file + * Store object in file. * * @param string $directory Directory of cache * @param string $filename Name of filecache @@ -2179,7 +2197,7 @@ function dol_filecache($directory, $filename, $object) } /** - * Test if Refresh needed + * Test if Refresh needed. * * @param string $directory Directory of cache * @param string $filename Name of filecache @@ -2195,7 +2213,7 @@ function dol_cache_refresh($directory, $filename, $cachetime) } /** - * Read object from cachefile + * Read object from cachefile. * * @param string $directory Directory of cache * @param string $filename Name of filecache diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 6a0ffad4149..0c19d216164 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1047,9 +1047,15 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r } } } + if ($showbarcode) $morehtmlleft.='
    '.$form->showbarcode($object).'
    '; - if ($object->element == 'societe' && ! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { - $morehtmlstatus.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased'); + + if ($object->element == 'societe') + { + if (! empty($conf->use_javascript_ajax) && $user->rights->societe->creer && ! empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) + { + $morehtmlstatus.=ajax_object_onoff($object, 'status', 'status', 'InActivity', 'ActivityCeased'); + } } elseif ($object->element == 'product') { @@ -1099,9 +1105,9 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r if ($object->element == 'product' || $object->element == 'bank_account') { - if(! empty($object->label)) $morehtmlref.='
    '.$object->label.'
    '; + if (! empty($object->label)) $morehtmlref.='
    '.$object->label.'
    '; } - + if ($object->element != 'product' && $object->element != 'bookmark') { $morehtmlref.='
    '; diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index ee162bd9cc8..daf82b2f995 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -47,7 +47,7 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= { dol_syslog("functions_dolibarr::check_user_password_dolibarr usertotest=".$usertotest." passwordtotest=".preg_replace('/./','*',$passwordtotest)." entitytotest=".$entitytotest); - // If test username/password asked, we define $test=false and $login var if ok, set $_SESSION["dol_loginmesg"] if ko + // If test username/password asked, we define $test=false if ko and $login var to login if ok, set also $_SESSION["dol_loginmesg"] if ko $table = MAIN_DB_PREFIX."user"; $usernamecol1 = 'login'; $usernamecol2 = 'email'; @@ -59,6 +59,9 @@ function check_user_password_dolibarr($usertotest,$passwordtotest,$entitytotest= if (preg_match('/@/',$usertotest)) $sql.=' OR '.$usernamecol2." = '".$db->escape($usertotest)."'"; $sql.=') AND '.$entitycol." IN (0," . ($entity ? $entity : 1) . ")"; $sql.=' AND statut = 1'; + // Required to first found the user into entity, then the superadmin. + // For the case (TODO and that we must avoid) a user has renamed its login with same value than a user in entity 0. + $sql.=' ORDER BY entity DESC'; $resql=$db->query($sql); if ($resql) diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index 3e3ec91dd60..96f0dca04fa 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -588,9 +588,9 @@ class ImportCsv extends ModeleImports { $updatedone = false; $insertdone = false; - if(!empty($updatekeys)) { + if (!empty($updatekeys)) { // We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields) - if(empty($lastinsertid)) { + if (empty($lastinsertid)) { $sqlSelect = 'SELECT rowid FROM '.$tablename; $data = array_combine($listfields, $listvalues); @@ -627,7 +627,7 @@ class ImportCsv extends ModeleImports } } - if(!empty($lastinsertid)) { + if (!empty($lastinsertid)) { // Build SQL UPDATE request $sqlstart = 'UPDATE '.$tablename; @@ -660,7 +660,7 @@ class ImportCsv extends ModeleImports } // Update not done, we do insert - if(!$error && !$updatedone) { + if (!$error && !$updatedone) { // Build SQL INSERT request $sqlstart = 'INSERT INTO '.$tablename.'('.implode(', ', $listfields).', import_key'; $sqlend = ') VALUES('.implode(', ', $listvalues).", '".$importid."'"; @@ -679,10 +679,10 @@ class ImportCsv extends ModeleImports if ($sql) { $resql=$this->db->query($sql); - $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). if ($resql) { - $insertdone = true; + $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). + $insertdone = true; } else { diff --git a/htdocs/core/modules/modDon.class.php b/htdocs/core/modules/modDon.class.php index f69cb1b5331..26dd397c913 100644 --- a/htdocs/core/modules/modDon.class.php +++ b/htdocs/core/modules/modDon.class.php @@ -32,7 +32,7 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; /** * Class to describe and enable module Donation */ -class modDon extends DolibarrModules +class modDon extends DolibarrModules { /** diff --git a/htdocs/core/modules/modNotification.class.php b/htdocs/core/modules/modNotification.class.php index c29c77b8f24..72c90ca7a6d 100644 --- a/htdocs/core/modules/modNotification.class.php +++ b/htdocs/core/modules/modNotification.class.php @@ -44,7 +44,7 @@ class modNotification extends DolibarrModules $this->family = "technic"; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i','',get_class($this)); - $this->description = "Gestion des notifications (par mail) sur evenement Dolibarr"; + $this->description = "EMail notifications (push) on business Dolibarr events"; $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); $this->special = 1; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 3772b44c9fc..e0aa28ce2d6 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -239,6 +239,23 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/',$conf->file
    global->MAIN_EASTER_EGG_COMMITSTRIP)) { + include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php'; + if (substr($langs->defaultlang,0,2)=='fr') { + $resgetcommitstrip = getURLContent("http://www.commitstrip.com/fr/feed/"); + } else { + $resgetcommitstrip = getURLContent("http://www.commitstrip.com/en/feed/"); + } + if ($resgetcommitstrip && $resgetcommitstrip['http_code'] == '200') + { + $xml = simplexml_load_string($resgetcommitstrip['content']); + $little = $xml->channel->item[0]->children('content',true); + print $little->encoded; + } +} + ?> '; +$out = '
    '; -$out .= '
    '; +$out .= ''; $out .= ''; $out .= ''; $out .= ''; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index d7e4d84baab..74349a16271 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2009 Regis Houssin * Copyright (C) 2014 Florian Henry - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2016 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -804,6 +804,39 @@ class Don extends CommonObject return $result; } + /** + * Charge indicateurs this->nb pour le tableau de bord + * + * @return int <0 if KO, >0 if OK + */ + function load_state_board() + { + global $conf; + + $this->nb=array(); + + $sql = "SELECT count(d.rowid) as nb"; + $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; + $sql.= " WHERE d.fk_statut > 0"; + $sql.= " AND d.entity IN (".getEntity('don', 1).")"; + + $resql=$this->db->query($sql); + if ($resql) + { + while ($obj=$this->db->fetch_object($resql)) + { + $this->nb["donations"]=$obj->nb; + } + $this->db->free($resql); + return 1; + } + else + { + dol_print_error($this->db); + $this->error=$this->db->error(); + return -1; + } + } /** * Return clicable name (with picto eventually) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 053e5b314d6..fb1a3168c3d 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2957,7 +2957,8 @@ class CommandeFournisseurLigne extends CommonOrderLine $sql.= ' cd.info_bits, cd.total_ht, cd.total_tva, cd.total_ttc,'; $sql.= ' cd.total_localtax1, cd.total_localtax2,'; $sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc,'; - $sql.= ' cd.date_start, cd.date_end, cd.fk_unit'; + $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'; $sql.= ' FROM '.MAIN_DB_PREFIX.'commande_fournisseurdet as cd'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON cd.fk_product = p.rowid'; $sql.= ' WHERE cd.rowid = '.$rowid; @@ -2965,6 +2966,7 @@ class CommandeFournisseurLigne extends CommonOrderLine if ($result) { $objp = $this->db->fetch_object($result); + $this->rowid = $objp->rowid; $this->id = $objp->rowid; $this->fk_commande = $objp->fk_commande; @@ -2992,10 +2994,15 @@ class CommandeFournisseurLigne extends CommonOrderLine $this->product_libelle = $objp->product_libelle; $this->product_desc = $objp->product_desc; - $this->date_start = $this->db->jdate($objp->date_start); - $this->date_end = $this->db->jdate($objp->date_end); - $this->fk_unit = $objp->fk_unit; - + $this->date_start = $this->db->jdate($objp->date_start); + $this->date_end = $this->db->jdate($objp->date_end); + $this->fk_unit = $objp->fk_unit; + + $this->multicurrency_subprice = $objp->multicurrency_subprice; + $this->multicurrency_total_ht = $objp->multicurrency_total_ht; + $this->multicurrency_total_tva = $objp->multicurrency_total_tva; + $this->multicurrency_total_ttc = $objp->multicurrency_total_ttc; + $this->db->free($result); return 1; } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 5602f573e90..009f765e5cd 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -2385,8 +2385,9 @@ class SupplierInvoiceLine extends CommonObjectLine { $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx'; $sql.= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; - $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; + $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_facture_fourn, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; + $sql.= ', f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; $sql.= ' WHERE f.rowid = '.$rowid; @@ -2407,6 +2408,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->id = $obj->rowid; $this->rowid = $obj->rowid; + $this->fk_facture_fourn = $obj->fk_facture_fourn; $this->description = $obj->description; $this->product_ref = $obj->product_ref; $this->ref = $obj->product_ref; @@ -2439,6 +2441,11 @@ class SupplierInvoiceLine extends CommonObjectLine $this->rang = $obj->rang; $this->fk_unit = $obj->fk_unit; + $this->multicurrency_subprice = $obj->multicurrency_subprice; + $this->multicurrency_total_ht = $obj->multicurrency_total_ht; + $this->multicurrency_total_tva = $obj->multicurrency_total_tva; + $this->multicurrency_total_ttc = $obj->multicurrency_total_ttc; + return 1; } diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 2a7744a97b7..b8ea51b8567 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1805,7 +1805,7 @@ elseif (! empty($object->id)) $morehtmlref.=''; $morehtmlref.=''; $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.=''; $morehtmlref.=''; } else { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 9549cbd879d..8a73f783642 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2053,7 +2053,7 @@ else $morehtmlref.='
    '; $morehtmlref.=''; $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=$formproject->select_projects((empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS)?$object->socid:-1), $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.=''; $morehtmlref.='
    '; } else { @@ -2454,6 +2454,7 @@ else print $langs->trans('AlreadyPaid'); print ' :
    0)?' class="amountalreadypaid"':'').'>' . price($totalpaye) . ' 
    '; //print ''; @@ -974,7 +975,7 @@ if ($resql) print ''. dol_print_date($objp->sellby,'day') .''; print $warehousestatic->getNomUrl(1); diff --git a/htdocs/product/stock/product.php b/htdocs/product/stock/product.php index 14cd07ec817..f12316591d0 100644 --- a/htdocs/product/stock/product.php +++ b/htdocs/product/stock/product.php @@ -110,7 +110,7 @@ $parameters=array('id'=>$id, 'ref'=>$ref, 'objcanvas'=>$objcanvas); $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'); -if($action == 'addlimitstockwarehouse') { +if ($action == 'addlimitstockwarehouse') { $seuil_stock_alerte = GETPOST('seuil_stock_alerte'); $desiredstock = GETPOST('desiredstock'); @@ -625,7 +625,8 @@ if ($id > 0 || $ref) print '
    '.$langs->trans("VirtualStock").'".(empty($stocktheo)?0:$stocktheo); + print '
    '; + print $form->textwithpicto($langs->trans("VirtualStock"), $langs->trans("VirtualStockDesc")); + print '"; + //print (empty($stocktheo)?0:$stocktheo); + print $form->textwithpicto((empty($stocktheo)?0:$stocktheo), $helpondiff); if ($object->seuil_stock_alerte != '' && ($object->stock_theorique < $object->seuil_stock_alerte)) print ' '.img_warning($langs->trans("StockLowerThanLimit")); print '
    '; - print $langs->trans("StockDiffPhysicTeoric"); - print ''; - - $found=0; - // Number of customer orders running - if (! empty($conf->commande->enabled)) - { - if ($found) print '
    '; else $found=1; - print $langs->trans("ProductQtyInCustomersOrdersRunning").': '.$object->stats_commande['qty']; - $result=$object->load_stats_commande(0,'0'); - if ($result < 0) dol_print_error($db,$object->error); - print ' ('.$langs->trans("ProductQtyInDraft").': '.$object->stats_commande['qty'].')'; - } - - // Number of product from customer order already sent (partial shipping) - if (! empty($conf->expedition->enabled)) - { - if ($found) print '
    '; else $found=1; - $result=$object->load_stats_sending(0,'2'); - print $langs->trans("ProductQtyInShipmentAlreadySent").': '.$object->stats_expedition['qty']; - } - - // Number of supplier order running - if (! empty($conf->fournisseur->enabled)) - { - if ($found) print '
    '; else $found=1; - $result=$object->load_stats_commande_fournisseur(0,'3,4'); - print $langs->trans("ProductQtyInSuppliersOrdersRunning").': '.$object->stats_commande_fournisseur['qty']; - $result=$object->load_stats_commande_fournisseur(0,'0,1,2'); - if ($result < 0) dol_print_error($db,$object->error); - print ' ('.$langs->trans("ProductQtyInDraftOrWaitingApproved").': '.$object->stats_commande_fournisseur['qty'].')'; - } - - // Number of product from supplier order already received (partial receipt) - if (! empty($conf->fournisseur->enabled)) - { - if ($found) print '
    '; else $found=1; - print $langs->trans("ProductQtyInSuppliersShipmentAlreadyRecevied").': '.$object->stats_reception['qty']; - } - - print '
    '."\n"; $linkback = '' . $langs->trans("BackToList") . ''; - // Ref - print ''; - print ''; - print ''; + dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'batch'); + + print '
    '; + print '
    '; + + print '
    ' . $langs->trans('Batch') . ''; - print $form->showrefnav($object, 'id', $linkback, 1, 'rowid', 'batch'); - print '
    '."\n"; // Product - print ''; print ''; @@ -364,7 +345,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Sell by print ''; print ''; @@ -375,6 +356,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
    '.$langs->trans("Product").''; + print '
    '.$langs->trans("Product").''; $producttmp = new Product($db); $producttmp->fetch($object->fk_product); print $producttmp->getNomUrl(1, 'stock'); @@ -356,7 +337,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Eat by print '
    '; print $form->editfieldkey($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; + print ''; print $form->editfieldval($langs->trans('Eatby'), 'eatby', $object->eatby, $object, $user->rights->stock->creer, 'datepicker'); print '
    '; print $form->editfieldkey($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); - print ''; + print ''; print $form->editfieldval($langs->trans('Sellby'), 'sellby', $object->sellby, $object, $user->rights->stock->creer, 'datepicker'); print '
    '; + print ''; + dol_fiche_end(); diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index 437361b5cf5..9185406a6ef 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -53,6 +53,8 @@ $type = GETPOST('type','int'); $tobuy = GETPOST('tobuy', 'int'); $salert = GETPOST('salert', 'alpha'); $mode = GETPOST('mode','alpha'); +$draftorder = GETPOST('draftorder','alpha'); + $fourn_id = GETPOST('fourn_id','int'); $fk_supplier = GETPOST('fk_supplier','int'); @@ -96,7 +98,9 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter.x") || GETP $snom = ''; $sal = ''; $salert = ''; + $draftorder=''; } +if($draftorder == 'on') $draftchecked = "checked"; // Create orders if ($action == 'order' && isset($_POST['valid'])) @@ -421,6 +425,7 @@ print ''; print ''; print ''; print ''; +print ''; print ''; print '
    '; print $langs->trans('Warehouse').' '.$formproduct->selectWarehouses($fk_entrepot, 'fk_entrepot', '', 1); @@ -433,10 +438,11 @@ print ''; $param = (isset($type)? '&type=' . $type : ''); -$param .= '&fourn_id=' . $fourn_id . '&snom='. $snom . '&salert=' . $salert; +$param .= '&fourn_id=' . $fourn_id . '&snom='. $snom . '&salert=' . $salert . '&draftorder='.$draftorder; $param .= '&sref=' . $sref; $param .= '&mode=' . $mode; $param .= '&fk_supplier=' . $fk_supplier; @@ -517,7 +524,7 @@ if (!empty($conf->service->enabled) && $type == 1) print '
      ' . $langs->trans('AlertOnly') . '  ' . $langs->trans('Draft') . '  '; $searchpitco=$form->showFilterAndCheckAddButtons(0); @@ -567,7 +574,12 @@ while ($i < ($limit ? min($num, $limit) : $num)) } // Force call prod->load_stats_xxx to choose status to count (otherwise it is loaded by load_stock function) - $result=$prod->load_stats_commande_fournisseur(0,'1,2,3,4'); + if(isset($draftchecked)){ + $result=$prod->load_stats_commande_fournisseur(0,'0,1,2,3,4'); + }else { + $result=$prod->load_stats_commande_fournisseur(0,'1,2,3,4'); + } + $result=$prod->load_stats_reception(0,'4'); //print $prod->stats_commande_fournisseur['qty'].'
    '."\n"; @@ -654,11 +666,12 @@ print '
    '; if ($num > $conf->liste_limit) { - if ($sref || $snom || $sall || $salert || GETPOST('search', 'alpha')) + if ($sref || $snom || $sall || $salert || $draftorder || GETPOST('search', 'alpha')) { $filters = '&sref=' . $sref . '&snom=' . $snom; $filters .= '&sall=' . $sall; $filters .= '&salert=' . $salert; + $filters .= '&draftorder=' . $draftorder; $filters .= '&mode=' . $mode; $filters .= '&fk_supplier=' . $fk_supplier; $filters .= '&fk_entrepot=' . $fk_entrepot; @@ -670,6 +683,7 @@ if ($num > $conf->liste_limit) $filters .= '&fourn_id=' . $fourn_id; $filters .= (isset($type)? '&type=' . $type : ''); $filters .= '&salert=' . $salert; + $filters .= '&draftorder=' . $draftorder; $filters .= '&mode=' . $mode; $filters .= '&fk_supplier=' . $fk_supplier; $filters .= '&fk_entrepot=' . $fk_entrepot; diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 757407a6692..28fd3dfadea 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -21,12 +21,14 @@ element == 'product') $productref = $object->ref; $langs->load("productbatch"); - if (empty($id)) $id = $object->id; + + if (empty($id)) $id = $object->id; print ' - - -
    + '; + print dol_fiche_head(); + + ?> + - + - - + - + - + - + - + - +
    - +
    >
    -
    -
    - + + +
    + +
    + + - -
    + '; + } + else + { if ($action === 'delete') { if ($prodcomb->fetch($valueid) > 0) { @@ -565,7 +583,22 @@ if (! empty($id) || ! empty($ref)) { " class="button">

    - + '; + print '
    '; + if ($productCombinations) { + print ''.$langs->trans('Copy').''; + } + print ''.$langs->trans('NewProductCombination').''; + print ''.$langs->trans('ProductCombinationGenerator').''; + print '
    '; + print '
'; + + + + ?> @@ -582,35 +615,48 @@ if (! empty($id) || ! empty($ref)) { - fetch($currcomb->fk_product_child); ?> - > - - - - - - - - - - + fetch($currcomb->fk_product_child); + ?> + > + + + + + + + + + + '; + } + ?>
trans('OnBuy') ?>
getNomUrl(1) ?> - fetchByFkCombination($currcomb->id); - $iMax = count($productCombination2ValuePairs); - - for ($i = 0; $i < $iMax; $i++) { - echo dol_htmlentities($productCombination2ValuePairs[$i]); - - if ($i !== ($iMax - 1)) { - echo ', '; - } - } ?> - variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?>variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuring_units_string($prodstatic->weight_units, 'weight') ?>getLibStatut(2, 0) ?>getLibStatut(2, 1) ?> - - -
getNomUrl(1) ?> + fetchByFkCombination($currcomb->id); + $iMax = count($productCombination2ValuePairs); + + for ($i = 0; $i < $iMax; $i++) { + echo dol_htmlentities($productCombination2ValuePairs[$i]); + + if ($i !== ($iMax - 1)) { + echo ', '; + } + } ?> + variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?>variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuring_units_string($prodstatic->weight_units, 'weight') ?>getLibStatut(2, 0) ?>getLibStatut(2, 1) ?> + + +
'.$langs->trans("None").'
@@ -618,17 +664,6 @@ if (! empty($id) || ! empty($ref)) { '; - print ' '; - print ''; - } }