diff --git a/ChangeLog b/ChangeLog index 1c4bbc9f6ef..96f459b4f64 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,8 +6,8 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.3 compared to 3.2.3 ***** For users: - New: [ task #289 ] Can reorder tasks. -- New: Add field "signature" into thirdparty card. If filled, text is added - at end of predefined email texts. If option MAIL_DO_NOT_USE_SIGN is on, this +- New: Add field "signature" into user card. If filled, text is added + at end of predefined email texts. If option MAIN_MAIL_DO_NOT_USE_SIGN is on, this feature is disabled. - New: Can input a payment back onto an credit note. - New: Add link "Back to list" on all cards. @@ -35,13 +35,13 @@ For users: - New: Support unique field for extrafields. - New: Extra fields supports more types (int, string, double, date, datetime). - New: Can correct stock of a warehouse from warehouse card. -- New: [ task #185 ]: Can input amount when correcting stock to recalculate PMP. -- New: [ task #454 ]: Add "No category" into filters on category. +- New: [ task #185 ] Can input amount when correcting stock to recalculate PMP. +- New: [ task #454 ] Add "No category" into filters on category. - New: Auto check box on page to edit interface options of user. - New: More surface control on stock correction page. - New: Add great britain provinces. - New: [ task #494 ] Send an email to foundation when a new member has auto-subscribed. -- New: [ task #326 ]: Add a numbering module to suggest automatically a product ref. +- New: [ task #326 ] Add a numbering module to suggest automatically a product ref. - New: Add conditional substitution IF/ELSEIF/ENDIF for ODT templates. - New: Add unit foot2, inch2, foot3 and inch3 for surface and volumes. - New: Can select thirdparties into emailing targets, even if module category is not enabled. @@ -61,9 +61,8 @@ For users: - New: Add new import options: Third parties bank details, warehouses and stocks, categories and suppliers prices - New: English bank account need a bank code (called sort code) to identify an account. - New: Can choose menu entry to show with external site module. -- New: Add hidden option MAIN_PDF_MARGIN_LEFT, MAIN_PDF_MARGIN_RIGHT, MAIN_PDF_MARGIN_TOP, MAIN_PDF_MARGIN_BOTTOM - to force margins of generated PDF. -- New: [ task #314 ] Can define if prof id are mandatory or not. +- New: Add hidden option MAIN_PDF_MARGIN_LEFT, MAIN_PDF_MARGIN_RIGHT, MAIN_PDF_MARGIN_TOP, MAIN_PDF_MARGIN_BOTTOM to force margins of generated PDF. +- New: [ task #314 ] Can define if prof id are mandatory or not. - New: Add button on order card to create intervention from services. - New: Add search box to find products by supplier reference. - New: Add option MAIN_HELPCENTER_LINKTOUSE to define target link "I need help" onto logon page. @@ -76,11 +75,15 @@ New experimental modules: - New: Add commissions management module. -- Fix: [ bug #499 ]: Supplier order input method not translated +- Fix: [ bug #499 ] Supplier order input method not translated - Fix: No images into product description lines as PDF generation does not work with this. - Fix: Errors weren't being shown in customer's & supplier's orders - Fix: Lastname wasn't being recorded in xinputuser emailing module. +- Fix: [ bug #653 ] Error while creating agenda additional attributes +- Fix: [ bug #654 ] Event rapport PDF showing ActionAC_OTH_AUTO +- Fix: [ bug #658 ] Search on bank do not work for description +- Fix: [ bug #659 ] Comment in recurrent invoices is not stored For developers: - New: Add webservice for thirdparty creation and list. @@ -103,7 +106,12 @@ For developers: - New: We can use a dynamic value ($conf->global->XXX for example) into titles of menus. - Qual: Renamed SUPPLIER_INVOICE_BUILDDOC trigger to BILL_SUPPLIER_BUILDDOC - Qual: Renamed INVOICE_SUPPLIER_DELETE trigger to BILL_SUPPLIER_DELETE -- Qual: Renamed SUPLLIER_ORDER_BUILDDOC trigger to ORDER_SUPPLIER_BUILDDOC +- Qual: Renamed SUPLIER_ORDER_BUILDDOC trigger to ORDER_SUPPLIER_BUILDDOC +- Qual: Renamed CONTRACTLINE_DELETE trigger to CONTRACT_LINE_DELETE +- Qual: Renamed all ficheinter.class.php triggers so that they start with 'FICHINTER_' +- Fix: [ bug #655 ] ORDER_REOPEN trigger incorrectly named +- Fix: [ bug #656 ] Contracts trigger CONTRACT_MODIFY incorrectly named +- Fix: [ bug #657 ] Usergroup class' GROUP_DELETE trigger incorrectly named For translators: - New: Update language files (de, tr, pt, ca, es, en, fr). diff --git a/build/launchpad/README b/build/launchpad/README index e49e1d213b9..2a1e7d138ca 100644 --- a/build/launchpad/README +++ b/build/launchpad/README @@ -25,13 +25,15 @@ a package onto LaunchPad bzr launchpad-login yourlogin bzr whoami "Your Name " bzr whoami +- Edit file ~/.bashrc to add +DEBFULLNAME="" +DEBEMAIL="" + +If you want to build/test package locally: - Create a file ~/.pbuilderrc with content COMPONENTS="main universe multiverse restricted" - Create chroot ubuntu env sudo pbuilder create [--distribution sid|squeeze] -- Edit file ~/.bashrc to add -DEBFULLNAME="" -DEBEMAIL="" # Push/declare sources to Launchpad @@ -41,14 +43,14 @@ DEBEMAIL="" mkdir bzr - Create a series Call it 'dev' or 'stable' - Add file with *: http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_3.2.*.tar.gz - ??? Configure Series branch - Link to series ??? + For stable: Add file with *: http://www.dolibarr.org/files/stable/package_debian-ubuntu/dolibarr_3.2.*.tar.gz + For dev: Configure Series branch - Link to series bzr init bzr add bzr commit -m "Init" - bzr push lp:~eldy/dolibarr/stable + bzr push lp:~yourlogin/dolibarr/stable -# Init package tools for launchpad +# Init repository of sources into launchpad (when repository for sources does not exist) #---------------------------------- - Create debian directory and upload it onto bzr branch ~yourlogin/+junk/debian-[dev|stable] @@ -59,14 +61,20 @@ DEBEMAIL="" bzr init bzr add bzr commit -m "Init control files" - bzr push lp:~eldy/+junk/debian-[dev|stable] (put here any branch name) + bzr push lp:~yourlogin/+junk/debian-[dev|stable] (put here any branch name) or download it from launchpad bazaar: cd bzr - bzr branch lp:~eldy/+junk/debian-[dev|stable] + bzr branch lp:~yourlogin/+junk/debian-[dev|stable] - To update this debian directory, edit files into the bzr dir and run bzr status bzr commit -m "Description of change" - bzr push lp:~eldy/+junk/debian-[dev|stable] + bzr push lp:~yourlogin/+junk/debian-[dev|stable] + +# Get repository of sources from launchpad (when repository for sources already exists) +#---------------------------------- + cd bzr + bzr branch lp:~yourlogin/+junk/debian-[dev|stable] + # Define a recipe into launchpad (a rule to build packages into a PPA) #---------------------------------- @@ -74,13 +82,18 @@ DEBEMAIL="" - Create a file dolibarr.recipe with content cd bzr vi dolibarr.recipe - # bzr-builder format 0.3 deb-version {debupstream}+{revno}+{revno:packaging} - lp:dolibarr - merge packaging lp:~eldy/dolibarr/debian + For dev: + # bzr-builder format 0.3 deb-version {debupstream}-0~{revno} + lp:dolibarr + merge packaging lp:~yourlogin/+junk/debian-dev + For stable: + # bzr-builder format 0.3 deb-version {debupstream}-0~{revno} + lp:dolibarr/stable + merge packaging lp:~yourlogin/+junk/debian-stable - Run command cd bzr bzr dailydeb dolibarr.recipe working-dir - This will create a directory "working-dir" with dolibarr sources and will add sources from ~eldy/dolibarr/debian + This will create a directory "working-dir" with dolibarr sources and will add sources from ~yourlogin/+junk/debian-[dev|stable] - Test package sources sudo pbuilder build /_.dsc @@ -94,11 +107,11 @@ Add signing key of the Launchpad repository: Add Dolibarr Launchpad repository to your system setup by adding the two lines to /etc/apt/sources.list For the development snapshot version: -deb http://ppa.launchpad.net/eldy/dolibarr-dev/ubuntu precise main -deb-src http://ppa.launchpad.net/eldy/dolibarr-dev/ubuntu precise main +deb http://ppa.launchpad.net/yourlogin/dolibarr-dev/ubuntu precise main +deb-src http://ppa.launchpad.net/yourlogin/dolibarr-dev/ubuntu precise main For the stable version: -deb http://ppa.launchpad.net/eldy/dolibarr-stable/ubuntu precise main -deb-src http://ppa.launchpad.net/eldy/dolibarr-stable/ubuntu precise main +deb http://ppa.launchpad.net/yourlogin/dolibarr-stable/ubuntu precise main +deb-src http://ppa.launchpad.net/yourlogin/dolibarr-stable/ubuntu precise main Update your package cache: > apt-get update diff --git a/build/obs/README b/build/obs/README index 0d0e99ffb51..24a6df2e84b 100644 --- a/build/obs/README +++ b/build/obs/README @@ -17,3 +17,16 @@ OBS:Screenshots URL of screenshot OBS:QualityCategory Development|Testing|Stable|Private OBS:Maintained 1 + +To submit a snapshot for building, we should have a service file with content + + + www.dolibarr.org + http + /files/lastbuild/package_rpm_generic/dolibarr-3.3.0-0.2.beta1.src.rpm + + + +How to have such a service ? +Try to make "Add file" and select Remote URL and enter http://www.dolibarr.org/files/lastbuild/package_rpm_generic/dolibarr-3.3.0-0.2.beta1.src.rpm + diff --git a/build/rpm/dolibarr_fedora.spec b/build/rpm/dolibarr_fedora.spec index c891761749a..228cf424730 100755 --- a/build/rpm/dolibarr_fedora.spec +++ b/build/rpm/dolibarr_fedora.spec @@ -14,7 +14,7 @@ Summary(es): Software ERP y CRM para pequeñas y medianas empresas, asociaciones Summary(fr): Logiciel ERP & CRM de gestion de PME/PMI, auto-entrepreneurs ou associations Summary(it): Programmo gestionale per piccole imprese, fondazioni e liberi professionisti -License: GPL-2+ +License: GPL-2.0+ #Packager: Laurent Destailleur (Eldy) Vendor: Dolibarr dev team diff --git a/build/rpm/dolibarr_generic.spec b/build/rpm/dolibarr_generic.spec index 8b6c7166d16..d14dd7654f5 100755 --- a/build/rpm/dolibarr_generic.spec +++ b/build/rpm/dolibarr_generic.spec @@ -18,7 +18,7 @@ Summary(es): Software ERP y CRM para pequeñas y medianas empresas, asociaciones Summary(fr): Logiciel ERP & CRM de gestion de PME/PMI, auto-entrepreneurs ou associations Summary(it): Programmo gestionale per piccole imprese, fondazioni e liberi professionisti -License: GPL-2+ +License: GPL-2.0+ #Packager: Laurent Destailleur (Eldy) Vendor: Dolibarr dev team diff --git a/build/rpm/dolibarr_mandriva.spec b/build/rpm/dolibarr_mandriva.spec index c5a85a8fe74..b2ed25e5eac 100755 --- a/build/rpm/dolibarr_mandriva.spec +++ b/build/rpm/dolibarr_mandriva.spec @@ -14,7 +14,7 @@ Summary(es): Software ERP y CRM para pequeñas y medianas empresas, asociaciones Summary(fr): Logiciel ERP & CRM de gestion de PME/PMI, auto-entrepreneurs ou associations Summary(it): Programmo gestionale per piccole imprese, fondazioni e liberi professionisti -License: GPL-2+ +License: GPL-2.0+ #Packager: Laurent Destailleur (Eldy) Vendor: Dolibarr dev team diff --git a/build/rpm/dolibarr_opensuse.spec b/build/rpm/dolibarr_opensuse.spec index d2109442024..d93b8ac3b14 100755 --- a/build/rpm/dolibarr_opensuse.spec +++ b/build/rpm/dolibarr_opensuse.spec @@ -14,7 +14,7 @@ Summary(es): Software ERP y CRM para pequeñas y medianas empresas, asociaciones Summary(fr): Logiciel ERP & CRM de gestion de PME/PMI, auto-entrepreneurs ou associations Summary(it): Programmo gestionale per piccole imprese, fondazioni e liberi professionisti -License: GPL-2+ +License: GPL-2.0+ #Packager: Laurent Destailleur (Eldy) Vendor: Dolibarr dev team diff --git a/htdocs/adherents/card_subscriptions.php b/htdocs/adherents/card_subscriptions.php index 92cac53a18f..568837befd2 100644 --- a/htdocs/adherents/card_subscriptions.php +++ b/htdocs/adherents/card_subscriptions.php @@ -46,7 +46,7 @@ $rowid=GETPOST('rowid','int'); $typeid=GETPOST('typeid','int'); // Security check -$result=restrictedArea($user,'adherent',$rowid); +$result=restrictedArea($user,'adherent',$rowid,'','cotisation'); $object = new Adherent($db); $extrafields = new ExtraFields($db); @@ -852,11 +852,12 @@ if ($rowid) $datefrom=dol_time_plus_duree($object->datefin,1,'d'); } else - { - $datefrom=dol_now(); + { + //$datefrom=dol_now(); + $datefrom=$object->datevalid; } } - $form->select_date($datefrom,'','','','',"cotisation"); + $form->select_date($datefrom,'','','','',"cotisation",1,1); print ""; // Date end subscription diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index 1b4fabaf47e..dfba0935953 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -46,8 +46,8 @@ if (! $sortfield) { $sortfield="c.dateadh"; } $msg=''; $date_select=isset($_GET["date_select"])?$_GET["date_select"]:$_POST["date_select"]; -if (! $user->rights->adherent->cotisation->lire) -accessforbidden(); +// Security check +$result=restrictedArea($user,'adherent','','','cotisation'); /* diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 60d7243c5fd..af2676a7d31 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -28,10 +28,12 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; - $langs->load("companies"); $langs->load("members"); +// Security check +$result=restrictedArea($user,'adherent'); + /* * View diff --git a/htdocs/adherents/liste.php b/htdocs/adherents/liste.php index 592881b2b72..5e26c9e35ab 100644 --- a/htdocs/adherents/liste.php +++ b/htdocs/adherents/liste.php @@ -31,6 +31,9 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; $langs->load("members"); $langs->load("companies"); +// Security check +$result=restrictedArea($user,'adherent'); + $action=GETPOST("action"); $filter=GETPOST("filter"); $statut=GETPOST("statut"); @@ -70,7 +73,6 @@ if (GETPOST("button_removefilter")) } - /* * View */ diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index dcc25501d84..12732ecdc47 100755 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -35,11 +35,10 @@ $mode=GETPOST('mode')?GETPOST('mode'):''; // Security check if ($user->societe_id > 0) { - $action = ''; - $socid = $user->societe_id; + $action = ''; + $socid = $user->societe_id; } -if (! $user->rights->adherent->cotisation->lire) - accessforbidden(); +$result=restrictedArea($user,'adherent','','','cotisation'); $year = strftime("%Y", time()); $startyear=$year-2; diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index cdc731ecdca..d78ab4fe61f 100755 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -37,8 +37,7 @@ if ($user->societe_id > 0) $action = ''; $socid = $user->societe_id; } -if (! $user->rights->adherent->cotisation->lire) -accessforbidden(); +$result=restrictedArea($user,'adherent','','','cotisation'); $year = strftime("%Y", time()); $startyear=$year-2; diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 0d5da2773f9..82dc17506e9 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -33,12 +33,14 @@ $HEIGHT=200; $userid=GETPOST('userid','int'); if ($userid < 0) $userid=0; $socid=GETPOST('socid','int'); if ($socid < 0) $socid=0; + // Security check if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; } +$result=restrictedArea($user,'adherent','','','cotisation'); $year = strftime("%Y", time()); $startyear=$year-2; diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 3f77c58d7ed..62d5d2c7808 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -371,7 +371,8 @@ if ($id == 11) 'propal' => $langs->trans('Proposal'), 'facture' => $langs->trans('Bill'), 'facture_fourn' => $langs->trans('SupplierBill'), - 'fichinter' => $langs->trans('InterventionCard') + 'fichinter' => $langs->trans('InterventionCard'), + 'agenda' => $langs->trans('Agenda') ); if (! empty($conf->global->MAIN_SUPPORT_CONTACT_TYPE_FOR_THIRDPARTIES)) $elementList["societe"] = $langs->trans('ThirdParty'); $sourceList = array( @@ -1247,7 +1248,7 @@ function fieldList($fieldlist,$obj='',$tabname='') $align="left"; if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="right"; // Fields aligned on right print ''; - print ''; + print ''; print ''; } elseif ($fieldlist[$field] == 'libelle_facture') { diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 39f7941679d..1e1cab8bf3b 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -168,138 +168,150 @@ else } -// Show examples -print ''.$langs->trans("ExamplesWithCurrentSetup").":
\n"; - -// Always show vat rates with vat 0 -$s=2/7;$qty=1;$vat=0; -$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0,0); -print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); -print " x ".$langs->trans("Quantity").": ".$qty; -print " - ".$langs->trans("VAT").": ".$vat.'%'; -print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; - -$s=10/3;$qty=1;$vat=0; -$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0,0); -print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); -print " x ".$langs->trans("Quantity").": ".$qty; -print " - ".$langs->trans("VAT").": ".$vat.'%'; -print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; - -$s=10/3;$qty=2;$vat=0; -$tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); -print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); -print " x ".$langs->trans("Quantity").": ".$qty; -print " - ".$langs->trans("VAT").": ".$vat.'%'; -print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; - -// Add vat rates examples specific to country -$vat_rates=array(); - -$sql.="SELECT taux as vat_rate"; -$sql.=" FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; -$sql.=" WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$mysoc->country_code."' AND taux != 0"; -$sql.=" ORDER BY t.taux ASC"; -$resql=$db->query($sql); -if ($resql) +if (empty($mysoc->country_code)) { - $num = $db->num_rows($resql); - if ($num) - { - for ($i = 0; $i < $num; $i++) - { - $obj = $db->fetch_object($resql); - $vat_rates[$i] = $obj->vat_rate; - } - } -} -else dol_print_error($db); - -if (count($vat_rates)) -{ - foreach($vat_rates as $vat) - { - for ($qty=1; $qty<=2; $qty++) - { - $s=10/3; - $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); - print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); - print " x ".$langs->trans("Quantity").": ".$qty; - print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; - } - } + $langs->load("errors"); + $warnpicto=img_error($langs->trans("WarningMandatorySetupNotComplete")); + print '
'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").''; } else { - // More examples if not specific vat rate found - // This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10) - // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule. - $s=10/3;$qty=1;$vat=10; - $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); - print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); - print " x ".$langs->trans("Quantity").": ".$qty; - print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + // Show examples + print ''.$langs->trans("ExamplesWithCurrentSetup").":
\n"; - $s=10/3;$qty=2;$vat=10; - $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); - print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); - print " x ".$langs->trans("Quantity").": ".$qty; - print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + // Always show vat rates with vat 0 + $s=2/7;$qty=1;$vat=0; + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0,0); + print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); + print " x ".$langs->trans("Quantity").": ".$qty; + print " - ".$langs->trans("VAT").": ".$vat.'%'; + print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; -} + $s=10/3;$qty=1;$vat=0; + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0,0); + print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); + print " x ".$langs->trans("Quantity").": ".$qty; + print " - ".$langs->trans("VAT").": ".$vat.'%'; + print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; -// Important: can debug rounding, to simulate the rounded total -/* -print '
'.$langs->trans("VATRoundedByLine").' ('.$langs->trans("DolibarrDefault").')
'; + $s=10/3;$qty=2;$vat=0; + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); + print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); + print " x ".$langs->trans("Quantity").": ".$qty; + print " - ".$langs->trans("VAT").": ".$vat.'%'; + print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; -foreach($vat_rates as $vat) -{ - for ($qty=1; $qty<=2; $qty++) + + // Add vat rates examples specific to country + $vat_rates=array(); + + $sql.="SELECT taux as vat_rate"; + $sql.=" FROM ".MAIN_DB_PREFIX."c_tva as t, ".MAIN_DB_PREFIX."c_pays as p"; + $sql.=" WHERE t.active=1 AND t.fk_pays = p.rowid AND p.code='".$mysoc->country_code."' AND taux != 0"; + $sql.=" ORDER BY t.taux ASC"; + $resql=$db->query($sql); + if ($resql) { - $s1=10/3; - $s2=2/7; - - // Round by line - $tmparray1=calcul_price_total(1,$qty*price2num($s1,'MU'),0,$vat,0,0,0,'HT',0, 0); - $tmparray2=calcul_price_total(1,$qty*price2num($s2,'MU'),0,$vat,0,0,0,'HT',0, 0); - $total_ht = $tmparray1[0] + $tmparray2[0]; - $total_tva = $tmparray1[1] + $tmparray2[1]; - $total_ttc = $tmparray1[2] + $tmparray2[2]; - - print $langs->trans("UnitPriceOfProduct").": ".(price2num($s1,'MU') + price2num($s2,'MU')); - print " x ".$langs->trans("Quantity").": ".$qty; - print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$total_ht.' / '.$total_tva.' / '.$total_ttc."
\n"; + $num = $db->num_rows($resql); + if ($num) + { + for ($i = 0; $i < $num; $i++) + { + $obj = $db->fetch_object($resql); + $vat_rates[$i] = $obj->vat_rate; + } + } } -} + else dol_print_error($db); -print '
'.$langs->trans("VATRoundedOnTotal").'
'; - -foreach($vat_rates as $vat) -{ - for ($qty=1; $qty<=2; $qty++) + if (count($vat_rates)) { - $s1=10/3; - $s2=2/7; - - // Global round - $subtotal_ht = (($qty*price2num($s1,'MU')) + ($qty*price2num($s2,'MU'))); - $tmparray3=calcul_price_total(1,$subtotal_ht,0,$vat,0,0,0,'HT',0, 0); - $total_ht = $tmparray3[0]; - $total_tva = $tmparray3[1]; - $total_ttc = $tmparray3[2]; - - print $langs->trans("UnitPriceOfProduct").": ".price2num($s1+$s2,'MU'); - print " x ".$langs->trans("Quantity").": ".$qty; - print " - ".$langs->trans("VAT").": ".$vat.'%'; - print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$total_ht.' / '.$total_tva.' / '.$total_ttc."
\n"; + foreach($vat_rates as $vat) + { + for ($qty=1; $qty<=2; $qty++) + { + $s=10/3; + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); + print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); + print " x ".$langs->trans("Quantity").": ".$qty; + print " - ".$langs->trans("VAT").": ".$vat.'%'; + print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + } + } } + else + { + // More examples if not specific vat rate found + // This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10) + // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule. + + $s=10/3;$qty=1;$vat=10; + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); + print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); + print " x ".$langs->trans("Quantity").": ".$qty; + print " - ".$langs->trans("VAT").": ".$vat.'%'; + print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + + $s=10/3;$qty=2;$vat=10; + $tmparray=calcul_price_total(1,$qty*price2num($s,'MU'),0,$vat,0,0,0,'HT',0, 0); + print $langs->trans("UnitPriceOfProduct").": ".price2num($s,'MU'); + print " x ".$langs->trans("Quantity").": ".$qty; + print " - ".$langs->trans("VAT").": ".$vat.'%'; + print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$tmparray[0].' / '.$tmparray[1].' / '.$tmparray[2]."
\n"; + + } + + // Important: can debug rounding, to simulate the rounded total + /* + print '
'.$langs->trans("VATRoundedByLine").' ('.$langs->trans("DolibarrDefault").')
'; + + foreach($vat_rates as $vat) + { + for ($qty=1; $qty<=2; $qty++) + { + $s1=10/3; + $s2=2/7; + + // Round by line + $tmparray1=calcul_price_total(1,$qty*price2num($s1,'MU'),0,$vat,0,0,0,'HT',0, 0); + $tmparray2=calcul_price_total(1,$qty*price2num($s2,'MU'),0,$vat,0,0,0,'HT',0, 0); + $total_ht = $tmparray1[0] + $tmparray2[0]; + $total_tva = $tmparray1[1] + $tmparray2[1]; + $total_ttc = $tmparray1[2] + $tmparray2[2]; + + print $langs->trans("UnitPriceOfProduct").": ".(price2num($s1,'MU') + price2num($s2,'MU')); + print " x ".$langs->trans("Quantity").": ".$qty; + print " - ".$langs->trans("VAT").": ".$vat.'%'; + print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$total_ht.' / '.$total_tva.' / '.$total_ttc."
\n"; + } + } + + print '
'.$langs->trans("VATRoundedOnTotal").'
'; + + foreach($vat_rates as $vat) + { + for ($qty=1; $qty<=2; $qty++) + { + $s1=10/3; + $s2=2/7; + + // Global round + $subtotal_ht = (($qty*price2num($s1,'MU')) + ($qty*price2num($s2,'MU'))); + $tmparray3=calcul_price_total(1,$subtotal_ht,0,$vat,0,0,0,'HT',0, 0); + $total_ht = $tmparray3[0]; + $total_tva = $tmparray3[1]; + $total_ttc = $tmparray3[2]; + + print $langs->trans("UnitPriceOfProduct").": ".price2num($s1+$s2,'MU'); + print " x ".$langs->trans("Quantity").": ".$qty; + print " - ".$langs->trans("VAT").": ".$vat.'%'; + print "   ->   ".$langs->trans("TotalPriceAfterRounding").": ".$total_ht.' / '.$total_tva.' / '.$total_ttc."
\n"; + } + } + */ } -*/ + llxFooter(); diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index a6af114308e..35a4f905eda 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -40,7 +40,7 @@ $substitutionarrayfortest=array( '__EMAIL__' => 'TESTEMail', '__LASTNAME__' => 'TESTLastname', '__FIRSTNAME__' => 'TESTFirstname', -'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIL_DO_NOT_USE_SIGN))?$user->signature:''), +'__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:''), //'__PERSONALIZED__' => 'TESTPersonalized' // Hiden because not used yet ); complete_substitutions_array($substitutionarrayfortest, $langs); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 7a83d625831..dd96c83e797 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -206,9 +206,8 @@ if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."
$nbofactivatedmodules=count($conf->modules); print $langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1)); if ($nbofactivatedmodules <= 1) print ' '.img_warning($langs->trans("YouMustEnableOneModule")); -print '
'."\n"; +print '
'."\n"; -print "
\n"; $h = 0; @@ -266,6 +265,11 @@ $head[$h][2] = 'marketplace'; $h++; +// Show warning about external users +print showModulesExludedForExternal($modules).'
'."\n"; +print "
\n"; + + dol_fiche_head($head, $mode, $langs->trans("Modules")); $var=true; @@ -495,9 +499,6 @@ else dol_fiche_end(); -// Pour eviter bug mise en page IE -print '
'; -print '
'; llxFooter(); diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 821da019a73..53515b1835f 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -28,6 +28,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/interface_50_modNotification_Noti $langs->load("admin"); $langs->load("other"); +$langs->load("orders"); +$langs->load("propal"); +$langs->load("bills"); // Security check if (!$user->admin) @@ -109,8 +112,14 @@ foreach($listofnotifiedevents as $notifiedevent) { $var=!$var; $label=$langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; + + if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder'); + elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal'); + elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill'); + elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order'); + print ''; - print ''.$notifiedevent['elementtype'].''; + print ''.$elementLabel.''; print ''.$notifiedevent['code'].''; print ''.$label.''; print ''; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index d01c3421b6b..28627537977 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -68,8 +68,12 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("DefaultRightsDesc"); print " ".$langs->trans("OnlyActiveElementsAreShown")."
\n"; + +// Show warning about external users +print showModulesExludedForExternal($modules).'
'."\n"; print "
\n"; + $head=security_prepare_head(); dol_fiche_head($head, 'default', $langs->trans("Security")); diff --git a/htdocs/comm/action/contact.php b/htdocs/comm/action/contact.php index c86792f4572..fd8e7a83dd3 100644 --- a/htdocs/comm/action/contact.php +++ b/htdocs/comm/action/contact.php @@ -309,7 +309,7 @@ if ($id > 0 || ! empty($ref)) print ''; $nbofcontacts=$form->select_contacts($selectedCompany,'','contactid'); - if ($nbofcontacts == 0) print $langs->trans("NoContactDefined"); + if ($nbofcontacts == 0) print $langs->trans("NoContactDefinedForThirdParty"); print ''; print ''; $formcompany->selectTypeContact($object,'','type','external','rowid'); diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index 03ae84cb051..9616acdd5f0 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -88,7 +88,7 @@ $object->substitutionarrayfortest=array( '__OTHER3__' => 'TESTOther3', '__OTHER4__' => 'TESTOther4', '__OTHER5__' => 'TESTOther5', - '__SIGNATURE__' => (($user->signature && empty($conf->global->MAIL_DO_NOT_USE_SIGN))?$user->signature:''), + '__SIGNATURE__' => (($user->signature && empty($conf->global->MAIN_MAIL_DO_NOT_USE_SIGN))?$user->signature:''), //'__PERSONALIZED__' => 'TESTPersonalized' // Not used yet ); if (!empty($conf->global->MAILING_EMAIL_UNSUBSCRIBE)) diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index f19458c0f03..35896917b86 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -30,7 +30,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $langs->load("commercial"); $langs->load("orders"); -if (! $user->rights->mailing->lire || $user->societe_id > 0) accessforbidden(); + +// Security check +$result=restrictedArea($user,'mailing'); /* diff --git a/htdocs/comm/mailing/liste.php b/htdocs/comm/mailing/liste.php index 3ad2198f3dd..549b621b763 100644 --- a/htdocs/comm/mailing/liste.php +++ b/htdocs/comm/mailing/liste.php @@ -27,14 +27,8 @@ require_once DOL_DOCUMENT_ROOT.'/comm/mailing/class/mailing.class.php'; $langs->load("mails"); -if (!$user->rights->mailing->lire) accessforbidden(); - -// Securite acces client -if ($user->societe_id > 0) -{ - $action = ''; - $socid = $user->societe_id; -} +// Security check +$result=restrictedArea($user,'mailing'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 2ca118c47cf..e8e72eace88 100755 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -34,12 +34,16 @@ $HEIGHT=200; $userid=GETPOST('userid','int'); if ($userid < 0) $userid=0; $socid=GETPOST('socid','int'); if ($socid < 0) $socid=0; -// Securite acces client +$id = GETPOST('id','int'); + +// Security check if ($user->societe_id > 0) { $action = ''; $socid = $user->societe_id; } +if ($user->societe_id) $socid=$user->societe_id; +$result = restrictedArea($user, 'deplacement', $id,''); $nowyear=strftime("%Y", dol_now()); $year = GETPOST('year')>0?GETPOST('year'):$nowyear; diff --git a/htdocs/compta/journal/index.php b/htdocs/compta/journal/index.php deleted file mode 100755 index 4b7e347204d..00000000000 --- a/htdocs/compta/journal/index.php +++ /dev/null @@ -1,68 +0,0 @@ - - * Copyright (C) 2007-2010 Jean Heimburger - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -require '../../main.inc.php'; - - -$langs->load("companies"); -$langs->load("other"); -$langs->load("compta"); - -// Protection if external user -if ($user->societe_id > 0) -{ - accessforbidden(); -} - - -/******************************************************************* -* ACTIONS -* -* Put here all code to do according to value of "action" parameter -********************************************************************/ - - -/*************************************************** -* PAGE -* -* Put here all code to build page -****************************************************/ - -llxHeader('','MyPageName',''); - -$form=new Form($db); - - -// Put here content of your page -// ... - -/*************************************************** -* LINKED OBJECT BLOCK -* -* Put here code to view linked object -****************************************************/ -/* - -$somethingshown=$myobject->showLinkedObjectBlock(); - -*/ - -// End of page -$db->close(); -llxFooter(); -?> \ No newline at end of file diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 826d40b00ec..529e70e550a 100755 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -41,11 +41,10 @@ $date_endmonth=GETPOST('date_endmonth'); $date_endday=GETPOST('date_endday'); $date_endyear=GETPOST('date_endyear'); -// Protection if external user -if ($user->societe_id > 0) - accessforbidden(); - -$result = restrictedArea($user, 'societe&facture'); +// Security check +if ($user->societe_id > 0) $socid = $user->societe_id; +if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); +if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); /* diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index e90ae2ef7e7..df18c41a697 100755 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -42,11 +42,10 @@ $date_endmonth=GETPOST('date_endmonth'); $date_endday=GETPOST('date_endday'); $date_endyear=GETPOST('date_endyear'); -// Protection if external user -if ($user->societe_id > 0) - accessforbidden(); - -$result = restrictedArea($user, 'societe&facture'); +// Security check +if ($user->societe_id > 0) $socid = $user->societe_id; +if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); +if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); /* * Actions diff --git a/htdocs/compta/resultat/bilan.php b/htdocs/compta/resultat/bilan.php index fb8526d077c..524f10b79aa 100644 --- a/htdocs/compta/resultat/bilan.php +++ b/htdocs/compta/resultat/bilan.php @@ -25,7 +25,11 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -if (!$user->rights->compta->resultat->lire) accessforbidden(); +// Security check +$socid = GETPOST('socid','int'); +if ($user->societe_id > 0) $socid = $user->societe_id; +if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); +if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); /* diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index e4b9ddeadf8..2fa2d09a864 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -42,8 +42,8 @@ $date_endyear=GETPOST('date_endyear'); // Security check $socid = GETPOST('socid','int'); if ($user->societe_id > 0) $socid = $user->societe_id; -if (! $user->rights->compta->resultat->lire && ! $user->rights->accounting->comptarapport->lire) - accessforbidden(); +if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); +if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); // Date range $year=GETPOST("year"); diff --git a/htdocs/compta/resultat/compteres.php b/htdocs/compta/resultat/compteres.php index 0e9a8db8595..74960f97de7 100644 --- a/htdocs/compta/resultat/compteres.php +++ b/htdocs/compta/resultat/compteres.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2004-2012 Laurent Destailleur * * 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 @@ -15,17 +15,22 @@ * along with this program. If not, see . */ - require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/tva/class/tva.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; -if (!$user->rights->compta->resultat->lire) accessforbidden(); +// Security check +$socid = GETPOST('socid','int'); +if ($user->societe_id > 0) $socid = $user->societe_id; +if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); +if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); + + /* -* Views -*/ + * Views + */ llxHeader(); $year=$_GET["year"]; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 9eb6016c585..4a100fe00dc 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -40,8 +40,9 @@ else { // Security check $socid = GETPOST('socid','int'); if ($user->societe_id > 0) $socid = $user->societe_id; -if (! $user->rights->compta->resultat->lire && ! $user->rights->accounting->comptarapport->lire) - accessforbidden(); +if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); +if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); + // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') $modecompta=(GETPOST("modecompta")?GETPOST("modecompta"):$conf->global->COMPTA_MODE); diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 1a01eba1c0e..4665c9b7758 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -27,11 +27,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; +$socid = GETPOST('socid','int'); + // Security check -$socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:''; if ($user->societe_id > 0) $socid = $user->societe_id; -if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->comptarapport->lire) -accessforbidden(); +if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); +if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); // Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') $modecompta = $conf->global->COMPTA_MODE; diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 3e71698da1b..5a5c8211665 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -39,10 +39,12 @@ $sortfield=isset($_GET["sortfield"])?$_GET["sortfield"]:$_POST["sortfield"]; if (! $sortorder) $sortorder="asc"; if (! $sortfield) $sortfield="nom"; +$socid = GETPOST('socid','int'); + // Security check -$socid = isset($_REQUEST["socid"])?$_REQUEST["socid"]:''; if ($user->societe_id > 0) $socid = $user->societe_id; -if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->comptarapport->lire) accessforbidden(); +if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); +if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); // Date range $year=GETPOST("year"); diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index c66b840fda0..699465c5c60 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -25,27 +25,28 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php'; - $year_start=GETPOST("year_start"); $year_current = strftime("%Y",time()); $nbofyear=4; if (! $year_start) { - $year_start = $year_current - ($nbofyear-1); - $year_end = $year_current; + $year_start = $year_current - ($nbofyear-1); + $year_end = $year_current; } else { - $year_end=$year_start + ($nbofyear-1); + $year_end=$year_start + ($nbofyear-1); } - $userid=GETPOST('userid','int'); -$socid=GETPOST('socid','int'); +$socid = GETPOST('socid','int'); +// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') +$modecompta = $conf->global->COMPTA_MODE; +if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"]; + // Security check if ($user->societe_id > 0) $socid = $user->societe_id; -if (!$user->rights->compta->resultat->lire && !$user->rights->accounting->comptarapport->lire) accessforbidden(); +if (! empty($conf->comptabilite->enabled)) $result=restrictedArea($user,'compta','','','resultat'); +if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accounting','','','comptarapport'); + -// Define modecompta ('CREANCES-DETTES' or 'RECETTES-DEPENSES') -$modecompta = $conf->global->COMPTA_MODE; -if ($_GET["modecompta"]) $modecompta=$_GET["modecompta"]; /* diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index a63e3f320e2..95d534609da 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -233,7 +233,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire) $sql.= " AND c.entity IN (".getEntity('contract').")"; $sql.= " AND c.statut = 0"; if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; - if ($socid) $sql.= " AND s.fk_soc = ".$socid; + if ($socid) $sql.= " AND c.fk_soc = ".$socid; $resql = $db->query($sql); diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 66824a28199..bc057f0a768 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -213,7 +213,7 @@ if ($resql) $productstatic->ref=$obj->pref; print $productstatic->getNomUrl(1,'',20); print $obj->label?' - '.dol_trunc($obj->label,16):''; - if (! empty($obj->description) && ! empty($conf->global->PRODUIT_DESC_IN_LIST)) print '
'.dol_nl2br($obj->description); + if (! empty($obj->description) && ! empty($conf->global->PRODUCT_DESC_IN_LIST)) print '
'.dol_nl2br($obj->description); } else { diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index ae10ddbdfe2..0735f298761 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -69,25 +69,31 @@ class box_activity extends ModeleBoxes include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $facturestatic=new Facture($db); $propalstatic=new Propal($db); $commandestatic=new Commande($db); - $textHead = $langs->trans("Activity"); + $nbofyears=2; + if (! empty($conf->global->MAIN_BOX_ACTIVITY_DURATION)) $nbofyears=$conf->global->MAIN_BOX_ACTIVITY_DURATION; + $textHead = $langs->trans("Activity").' ('.$nbofyears.' '.$langs->trans("years").')'; $this->info_box_head = array('text' => $textHead, 'limit'=> dol_strlen($textHead)); + // compute the year limit to show + $tmpdate= dol_time_plus_duree(time(), -1*$nbofyears, "y"); + // list the summary of the bills if (! empty($conf->facture->enabled) && $user->rights->facture->lire) { - // compute the year limit to show - $tmpdate= dol_time_plus_duree(time(), -2, "y"); - - // we select only the payed bill grouped by years - $sql = "SELECT DATE_FORMAT(f.datef,'%Y') as annee, f.paye, f.fk_statut, sum(f.total_ttc) as Mnttot, count(*) as nb"; - $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f)"; - $sql.= " WHERE f.fk_soc = s.rowid"; - $sql.= " AND s.entity = ".$conf->entity; - $sql.= " AND DATE_FORMAT(f.datef,'%Y') >= ".date('Y',$tmpdate)." and paye=1"; + $sql = "SELECT f.paye, f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; + $sql.= " FROM (".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ")"; + $sql.= " WHERE f.entity = ".$conf->entity; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + $sql.= " AND f.fk_soc = s.rowid"; + $sql.= " AND f.datef >= '".$db->idate($tmpdate)."' AND paye=1"; $sql.= " GROUP BY f.paye, f.fk_statut "; $sql.= " ORDER BY f.fk_statut DESC"; @@ -100,16 +106,16 @@ class box_activity extends ModeleBoxes { $this->info_box_contents[$i][0] = array('td' => 'align="left" width="16"', 'logo' => 'bill'); $objp = $db->fetch_object($result); - + $this->info_box_contents[$i][1] = array('td' => 'align="left"', 'text' => $langs->trans("Bills")." ".$facturestatic->LibStatut($objp->paye,$objp->fk_statut,0)." ".$objp->annee); $billurl="viewstatut=2&paye=1&year=".$objp->annee; $this->info_box_contents[$i][2] = array('td' => 'align="right"', 'text' => $objp->nb, 'url' => DOL_URL_ROOT."/compta/facture/liste.php?".$billurl."&mainmenu=accountancy&leftmenu=customers_bills" ); - + $this->info_box_contents[$i][3] = array('td' => 'align="right"', - 'text' => dol_trunc(number_format($objp->Mnttot, 0, ',', ' '),40)." ".$langs->trans("Currency".$conf->currency) + 'text' => dol_trunc(number_format($objp->Mnttot, 0, ',', ' '),40)." ".getCurrencySymbol($conf->currency) ); // We add only for the current year if ($objp->annee == date("Y")) @@ -122,12 +128,13 @@ class box_activity extends ModeleBoxes } if ($num==0) $this->info_box_contents[$i][0] = array('td' => 'align="center"','text'=>$langs->trans("NoRecordedInvoices")); } - - $sql = "SELECT f.paye, f.fk_statut, sum(f.total_ttc) as Mnttot, count(*) as nb"; + else dol_print_error($db); + + $sql = "SELECT f.paye, f.fk_statut, SUM(f.total_ttc) as Mnttot, COUNT(*) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f"; $sql.= " WHERE f.entity = ".$conf->entity; $sql.= " AND f.fk_soc = s.rowid"; - $sql.= " AND paye=0"; + $sql.= " AND paye=0"; $sql.= " GROUP BY f.paye, f.fk_statut "; $sql.= " ORDER BY f.fk_statut DESC"; @@ -169,11 +176,15 @@ class box_activity extends ModeleBoxes // list the summary of the orders if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { - $sql = "SELECT c.fk_statut,c.facture, sum(c.total_ttc) as Mnttot, count(*) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; + $sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ")"; $sql.= " WHERE c.entity = ".$conf->entity; $sql.= " AND c.fk_soc = s.rowid"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + $sql.= " AND c.date_commande >= '".$db->idate($tmpdate)."'"; $sql.= " AND c.facture=0"; $sql.= " GROUP BY c.fk_statut"; $sql.= " ORDER BY c.fk_statut DESC"; @@ -207,16 +218,22 @@ class box_activity extends ModeleBoxes $i++; } } + else dol_print_error($db); } // list the summary of the propals if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { $sql = "SELECT p.fk_statut, sum(p.total) as Mnttot, count(*) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; + $sql.= " FROM (".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p"; + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= ")"; $sql.= " WHERE p.entity = ".$conf->entity; $sql.= " AND p.fk_soc = s.rowid"; - $sql.= " AND p.date_cloture IS NULL "; // just unclosed + if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; + if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id; + $sql.= " AND p.datep >= '".$db->idate($tmpdate)."'"; + $sql.= " AND p.date_cloture IS NULL"; // just unclosed $sql.= " GROUP BY p.fk_statut"; $sql.= " ORDER BY p.fk_statut DESC"; @@ -249,6 +266,7 @@ class box_activity extends ModeleBoxes $i++; } } + else dol_print_error($db); } // Add the sum in the bottom of the boxes diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index cdef1458b2c..d131db5e89b 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -386,7 +386,7 @@ class Conf $this->mailing->email_from=$this->email_from; if (! empty($this->global->MAILING_EMAIL_FROM)) $this->mailing->email_from=$this->global->MAILING_EMAIL_FROM; - // Format for date (used by default when not found or searched in lang) + // Format for date (used by default when not found or not searched in lang) $this->format_date_short="%d/%m/%Y"; // Format of day with PHP/C tags (strftime functions) $this->format_date_short_java="dd/MM/yyyy"; // Format of day with Java tags $this->format_hour_short="%H:%M"; @@ -406,7 +406,10 @@ class Conf if (! isset($this->global->MAIN_MAX_DECIMALS_SHOWN)) $this->global->MAIN_MAX_DECIMALS_SHOWN=8; // Default max file size for upload - $this->maxfilesize = (! empty($this->global->MAIN_UPLOAD_DOC) ? $this->global->MAIN_UPLOAD_DOC * 1024 : 0); + $this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024); + + // Define list of limited modules + if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='facture,commande,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda'; // '' means 'all'. Note that contact is added here as it should be a module later. // Timeouts if (empty($this->global->MAIN_USE_CONNECT_TIMEOUT)) $this->global->MAIN_USE_CONNECT_TIMEOUT=10; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d7342b87732..6cf1f3aff41 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -826,7 +826,7 @@ class Form * @param int $socid Id ot third party or 0 for all * @param string $selected Id contact pre-selectionne * @param string $htmlname Name of HTML field ('none' for a not editable field) - * @param int $showempty 0=no empty value, 1=add an empty value + * @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit) * @param string $exclude List of contacts id to exclude * @param string $limitto Disable answers that are not id in this array list * @param string $showfunction Add function into label @@ -863,7 +863,8 @@ class Form $num=$this->db->num_rows($resql); if ($htmlname != 'none' || $options_only) $out.= ''."\n"; +print ''."\n"; print ''."\n"; print ''."\n"; diff --git a/htdocs/holiday/common.inc.php b/htdocs/holiday/common.inc.php index 2b01471a36f..4a3f1049557 100644 --- a/htdocs/holiday/common.inc.php +++ b/htdocs/holiday/common.inc.php @@ -50,12 +50,16 @@ $sql.= " WHERE name = 'userGroup'"; $result = $db->query($sql); $obj = $db->fetch_object($result); -if ($obj->value == NULL) +if ($obj->value == null) { llxHeader('',$langs->trans('CPTitreMenu')); - print '
'; - print ''.$langs->trans('NotConfigModCP').''; - print '
'; + + $langs->load("errors"); + $warnpicto=img_error($langs->trans("WarningMandatorySetupNotComplete")); + print '
'; + print $warnpicto.' '.$langs->trans("NotConfigModCP"); + print '
'; + llxFooter(); exit(); } diff --git a/htdocs/imports/import.php b/htdocs/imports/import.php index ad0369299e8..d70f63cebd7 100644 --- a/htdocs/imports/import.php +++ b/htdocs/imports/import.php @@ -36,7 +36,6 @@ $langs->load("exports"); $langs->load("errors"); // Security check -if (! empty($user->societe_id)) $socid=$user->societe_id; $result=restrictedArea($user, 'import'); $entitytoicon=array( diff --git a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql index 3a0f6b9cd29..b3353d1b526 100755 --- a/htdocs/install/mysql/migration/3.2.0-3.3.0.sql +++ b/htdocs/install/mysql/migration/3.2.0-3.3.0.sql @@ -907,3 +907,4 @@ ALTER TABLE llx_element_lock DROP COLUMN fk_user_modif; ALTER TABLE llx_element_lock DROP COLUMN status; DELETE FROM llx_c_action_trigger WHERE elementtype='withdraw'; +UPDATE llx_c_action_trigger SET code='FICHINTER_VALIDATE' WHERE code='FICHEINTER_VALIDATE'; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 89d200d7731..4ec24bb0232 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -929,6 +929,7 @@ TotalNumberOfActivatedModules=Total number of activated feature modules: %s%s. -FTPFailedToRemoveDir=Failed to remove directory %s (Check permissions and that directory is empty). \ No newline at end of file +FTPFailedToRemoveDir=Failed to remove directory %s (Check permissions and that directory is empty). +FTPPassiveMode=Passive mode \ No newline at end of file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 9696eb55e79..dc2ee6b225e 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -107,6 +107,7 @@ Activated=Activated Closed=Closed Closed2=Closed Enabled=Enabled +Deprecated=Deprecated Disable=Disable Disabled=Disabled Add=Add diff --git a/htdocs/langs/en_US/paypal.lang b/htdocs/langs/en_US/paypal.lang index 1049658abf2..f06ce5f6309 100644 --- a/htdocs/langs/en_US/paypal.lang +++ b/htdocs/langs/en_US/paypal.lang @@ -10,6 +10,8 @@ PAYPAL_API_USER=API username PAYPAL_API_PASSWORD=API password PAYPAL_API_SIGNATURE=API signature PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Offer payment "integral" (Credit card+Paypal) or "Paypal" only +PaypalModeIntegral=Integral +PaypalModeOnlyPaypal=PayPal only PAYPAL_CSS_URL=Optionnal Url of CSS style sheet on payment page ThisIsTransactionId=This is id of transaction: %s PAYPAL_ADD_PAYMENT_URL=Add the url of Paypal payment when you send a document by mail diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index c14ebde7308..a62aa93fc80 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -1179,7 +1179,7 @@ LDAPFieldSidExample=Ejemplo : objectsid LDAPFieldEndLastSubscription=Fecha finalización como miembro LDAPParametersAreStillHardCoded=Los parámetros LDAP son codificados en duro (en la clase contact) LDAPSetupNotComplete=Configuración LDAP incompleta (a completar en las otras pestañas) -LDAPNoUserOrPasswordProvidedAccessIsReadOnly=Administrador o contraseña no inindicados. Los accesos LDAP serán anónimos y en solo lectura. +LDAPNoUserOrPasswordProvidedAccessIsReadOnly=Administrador o contraseña no indicados. Los accesos LDAP serán anónimos y en solo lectura. LDAPDescContact=Esta página permite definir el nombre de los atributos del árbol LDAP para cada información de los contactos Dolibarr. LDAPDescUsers=Esta página permite definir el nombre de los atributos del árbol LDAP para cada información de los usuarios Dolibarr. LDAPDescGroups=Esta página permite definir el nombre de los atributos del árbol LDAP para cada información de los grupos usuarios Dolibarr. diff --git a/htdocs/langs/es_ES/agenda.lang b/htdocs/langs/es_ES/agenda.lang index 70dcc71f09c..1b881cf96be 100644 --- a/htdocs/langs/es_ES/agenda.lang +++ b/htdocs/langs/es_ES/agenda.lang @@ -75,3 +75,7 @@ ExtSitesNbOfAgenda=Número de calendarios AgendaExtNb=Calendario nº %s ExtSiteUrlAgenda=Url de acceso al archivo .ical ExtSiteNoLabel=Sin descripción + +# Type contacts +TypeContact_agenda_internal_GUEST=Invitado +TypeContact_agenda_external_GUEST=Invitado diff --git a/htdocs/langs/es_ES/ftp.lang b/htdocs/langs/es_ES/ftp.lang index 4409603b337..75173ad5338 100644 --- a/htdocs/langs/es_ES/ftp.lang +++ b/htdocs/langs/es_ES/ftp.lang @@ -9,4 +9,5 @@ FTPFeatureNotSupportedByYourPHP=Su PHP no soporta las funciones FTP FailedToConnectToFTPServer=No se pudo conectar con el servidor FTP (servidor: %s, puerto %s) FailedToConnectToFTPServerWithCredentials=No se pudo conectar con el login/contraseña FTP configurados FTPFailedToRemoveFile=No se pudo eliminar el archivo %s. -FTPFailedToRemoveDir=No se pudo eliminar el directorio %s (Compruebe los permisos y que el directorio está vacío). \ No newline at end of file +FTPFailedToRemoveDir=No se pudo eliminar el directorio %s (Compruebe los permisos y que el directorio está vacío). +FTPPassiveMode=Modo pasivo \ No newline at end of file diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index 4f337f1f0a8..dbafcb393b2 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -107,6 +107,7 @@ Closed2=Cerrado Enabled=Activado Disable=Desactivar Disabled=Desactivado +Deprecated=Obsoleto Create=Crear Add=Añadir AddLink=Enlazar diff --git a/htdocs/langs/es_ES/paypal.lang b/htdocs/langs/es_ES/paypal.lang index d1fc5aefb97..9a4cb77ee55 100644 --- a/htdocs/langs/es_ES/paypal.lang +++ b/htdocs/langs/es_ES/paypal.lang @@ -10,6 +10,8 @@ PAYPAL_API_USER=Nombre usuario API PAYPAL_API_PASSWORD=Contraseña usuario API PAYPAL_API_SIGNATURE=Firma API PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Proponer pago integral (Tarjeta+Paypal) o sólo Paypal +PaypalModeIntegral=Integral +PaypalModeOnlyPaypal=Sólo PayPal PAYPAL_CSS_URL=Url opcional de la hoja de estilo CSS de la página de pago ThisIsTransactionId=Identificador de la transacción: %s PAYPAL_ADD_PAYMENT_URL=Añadir la url del pago Paypal al enviar un documento por e-mail diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index cedc06496d9..adb0a063d5d 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -936,6 +936,7 @@ TranslationSetup=Translation setup TranslationDesc=Le choix de la langue affichée à l'écran se modifie:
* Soit de manière globale depuis le menu Accueil - Configuration - Affichage
* Soit de manière spécifique à l'utilisateur depuis l'onglet Interface utilisateur de sa fiche utilisateur (cliquer sur le login en haut de l'écran). ClassNotFoundIntoPathWarning=La class %s n'a pas été trouvée dans le path PHP YesInSummer=Oui en été +OnlyFollowingModulesAreOpenedToExternalUsers=Remarque, seuls les modules suivants sont ouverts aux utilisateurs externes (quelquesoit les permissions de ces utilisateurs): ##### Module password generation= undefined PasswordGenerationStandard= Renvoie un mot de passe généré selon algorithme interne Dolibarr: 8 caractères, chiffres et caractères en minuscules mélangés. diff --git a/htdocs/langs/fr_FR/companies.lang b/htdocs/langs/fr_FR/companies.lang index 72115f17e5f..254d1e8af16 100644 --- a/htdocs/langs/fr_FR/companies.lang +++ b/htdocs/langs/fr_FR/companies.lang @@ -255,7 +255,8 @@ AddContactAddress=Créer contact/adresse EditContact=Editer contact EditContactAddress=Editer contact/adresse Contact=Contact -NoContactDefined=Aucun contact défini pour ce tiers +NoContactDefinedForThirdParty=Aucun contact défini pour ce tiers +NoContactDefined=Aucun contact défini DefaultContact=Contact par défaut AddCompany=Créer société AddThirdParty=Créer tiers diff --git a/htdocs/langs/fr_FR/ftp.lang b/htdocs/langs/fr_FR/ftp.lang index dca72e7e8dd..e92d32b7ab8 100644 --- a/htdocs/langs/fr_FR/ftp.lang +++ b/htdocs/langs/fr_FR/ftp.lang @@ -9,4 +9,5 @@ FTPFeatureNotSupportedByYourPHP=Votre PHP ne supporte pas les fonctions FTP FailedToConnectToFTPServer=Échec de connexion au serveur FTP (serveur: %s, port %s) FailedToConnectToFTPServerWithCredentials=Échec de login avec le login/mot de passe FTP configuré FTPFailedToRemoveFile=Échec suppression fichier %s. -FTPFailedToRemoveDir=Échec suppression répertoire %s (Vérifiez les permissions et que le répertoire soit vide). \ No newline at end of file +FTPFailedToRemoveDir=Échec suppression répertoire %s (Vérifiez les permissions et que le répertoire soit vide). +FTPPassiveMode=Mode passif \ No newline at end of file diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 94abdab4da2..e402a8cd1fe 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -107,6 +107,7 @@ Closed2=Fermé Enabled=Actif Disable=Désactiver Disabled=Désactivé +Deprecated=Obsolète Create=Créer Add=Ajouter AddLink=Lier diff --git a/htdocs/langs/fr_FR/paypal.lang b/htdocs/langs/fr_FR/paypal.lang index b1d627163e3..74d8a76804a 100644 --- a/htdocs/langs/fr_FR/paypal.lang +++ b/htdocs/langs/fr_FR/paypal.lang @@ -10,6 +10,8 @@ PAYPAL_API_USER=Nom utilisateur API PAYPAL_API_PASSWORD=Mot de passe utilisateur API PAYPAL_API_SIGNATURE=Signature API PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Proposer le paiement intégral (Carte+Paypal) ou Paypal seul +PaypalModeIntegral=Intégral +PaypalModeOnlyPaypal=PayPal seul PAYPAL_CSS_URL=Url optionnelle de la feuille de style CSS de la page de paiement ThisIsTransactionId=Voici l'identifiant de la transaction: %s PAYPAL_ADD_PAYMENT_URL=Ajouter l'url de paiement Paypal lors de l'envoi d'un document par mail diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index d7336391bfc..93d23f42ac8 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -157,7 +157,7 @@ print "\n"; $var=!$var; print ''; print $langs->trans("PAYPAL_API_INTEGRAL_OR_PAYPALONLY").''; -print $form->selectarray("PAYPAL_API_INTEGRAL_OR_PAYPALONLY",array('integral'=>'Integral','paypalonly'=>'Paypal only'),$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY); +print $form->selectarray("PAYPAL_API_INTEGRAL_OR_PAYPALONLY",array('integral'=> $langs->trans('PaypalModeIntegral'),'paypalonly'=> $langs->trans('PaypalModeOnlyPaypal')),$conf->global->PAYPAL_API_INTEGRAL_OR_PAYPALONLY); print ''; /*$var=!$var; diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index ca0d6718e0e..e19a7f605a6 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -22,7 +22,7 @@ */ // TODO We must add a confirmation on button because this will make a mass change -// TODO Should also change table product_price for price levels +// FIXME Should also change table product_price for price levels require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; @@ -128,6 +128,8 @@ if ($action == 'convert') * View */ +$form=new Form($db); + $title = $langs->trans('ModulesSystemTools'); llxHeader('',$title); @@ -136,55 +138,63 @@ print_fiche_titre($title,'','setup'); print $langs->trans("ProductVatMassChangeDesc").'

'; -$form=new Form($db); -$var=true; +if (empty($mysoc->country_code)) +{ + $langs->load("errors"); + $warnpicto=img_error($langs->trans("WarningMandatorySetupNotComplete")); + print '
'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").''; +} +else +{ -print '
'; -print ''; -print ''; + $var=true; -print ''; -print ''; -print ''."\n"; -print ''."\n"; -print ''."\n"; + print ''; + print ''; + print ''; -$var=!$var; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; + print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("OldVATRates").''."\n"; -print $form->load_tva('oldvatrate', $oldvatrate); -print '
'; + print ''; + print ''."\n"; + print ''."\n"; + print ''."\n"; -$var=!$var; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; + $var=!$var; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; -/* -$var=!$var; -print ''."\n"; -print ''."\n"; -print ''."\n"; -print ''."\n"; -*/ + $var=!$var; + print ''."\n"; + print ''."\n"; + print ''."\n"; + print ''."\n"; -print '
'.$langs->trans("Parameters").''.$langs->trans("Value").'
'.$langs->trans("NewVATRates").''."\n"; -print $form->load_tva('newvatrate', $newvatrate); -print '
'.$langs->trans("OldVATRates").''."\n"; + print $form->load_tva('oldvatrate', $oldvatrate); + print '
'.$langs->trans("PriceBaseTypeToChange").''."\n"; -print $form->load_PriceBaseType($price_base_type); -print '
'.$langs->trans("NewVATRates").''."\n"; + print $form->load_tva('newvatrate', $newvatrate); + print '
'; -print ''; + /* + $var=!$var; + print ''."\n"; + print ''.$langs->trans("PriceBaseTypeToChange").''."\n"; + print ''."\n"; + print $form->load_PriceBaseType($price_base_type); + print ''."\n"; + print ''."\n"; + */ -// Boutons actions -print '
'; -print ''; -print '
'; + print ''; + print ''; -print '
'; + // Boutons actions + print '
'; + print ''; + print '
'; + print ''; +} llxFooter(); diff --git a/htdocs/product/stock/fiche-valo.php b/htdocs/product/stock/fiche-valo.php index ef79496af20..976df224365 100644 --- a/htdocs/product/stock/fiche-valo.php +++ b/htdocs/product/stock/fiche-valo.php @@ -31,6 +31,8 @@ $langs->load("stocks"); $langs->load("companies"); $mesg = ''; +// Security check +$result=restrictedArea($user,'stock'); /* diff --git a/htdocs/product/stock/fiche.php b/htdocs/product/stock/fiche.php index 2102de86d25..fbf597aee34 100644 --- a/htdocs/product/stock/fiche.php +++ b/htdocs/product/stock/fiche.php @@ -44,6 +44,10 @@ if (! $sortorder) $sortorder="DESC"; $mesg = ''; +// Security check +$result=restrictedArea($user,'stock'); + + /* * Actions diff --git a/htdocs/product/stock/index.php b/htdocs/product/stock/index.php index 9e65a8d41db..76732b5ac07 100644 --- a/htdocs/product/stock/index.php +++ b/htdocs/product/stock/index.php @@ -29,8 +29,8 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; $langs->load("stocks"); -if (!$user->rights->stock->lire) - accessforbidden(); +// Security check +$result=restrictedArea($user,'stock'); /* diff --git a/htdocs/product/stock/info.php b/htdocs/product/stock/info.php index 46e13daee1f..0dc4938ab2f 100644 --- a/htdocs/product/stock/info.php +++ b/htdocs/product/stock/info.php @@ -28,6 +28,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; $langs->load("stocks"); +// Security check +$result=restrictedArea($user,'stock'); + + /* * View */ diff --git a/htdocs/product/stock/liste.php b/htdocs/product/stock/liste.php index 29402b26066..b571f5bb3ff 100644 --- a/htdocs/product/stock/liste.php +++ b/htdocs/product/stock/liste.php @@ -28,8 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; $langs->load("stocks"); -if (!$user->rights->stock->lire) - accessforbidden(); +// Security check +$result=restrictedArea($user,'stock'); $sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"]; $snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"]; diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index 172f2211947..22c2d1baea6 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -35,7 +35,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $langs->load("products"); $langs->load("stocks"); -if (!$user->rights->produit->lire) accessforbidden(); +// Security check +$result=restrictedArea($user,'stock'); $id=GETPOST('id','int'); $product_id=GETPOST("product_id"); diff --git a/htdocs/product/stock/valo.php b/htdocs/product/stock/valo.php index c6631ad078e..5addef0fbb7 100644 --- a/htdocs/product/stock/valo.php +++ b/htdocs/product/stock/valo.php @@ -28,8 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; $langs->load("stocks"); -if (!$user->rights->stock->lire) -accessforbidden(); +// Security check +$result=restrictedArea($user,'stock'); $sref=isset($_GET["sref"])?$_GET["sref"]:$_POST["sref"]; $snom=isset($_GET["snom"])?$_GET["snom"]:$_POST["snom"]; diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 3ab689d56f3..260296ee39e 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -847,7 +847,7 @@ class Project extends CommonObject * @param int $mode 0=All project I have permission on, 1=Projects affected to me only, 2=Will return list of all projects with no test on contacts * @param int $list 0=Return array,1=Return string list * @param int $socid 0=No filter on third party, id of third party - * @return array Array of projects + * @return array or string Array of projects id, or string with projects id separated with "," */ function getProjectsAuthorizedForUser($user, $mode=0, $list=0, $socid=0) { @@ -910,7 +910,7 @@ class Project extends CommonObject if ($list) { - if (empty($temp)) return 0; + if (empty($temp)) return '0'; $result = implode(',', $temp); return $result; } diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index d4ba1f2733d..fd314fef0a8 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -290,36 +290,40 @@ if ($action == 'update' && ! $_POST["cancel"]) if ($caneditfield) // Case we can edit all field { - if (! $_POST["nom"]) + $error=0; + + if (! $_POST["nom"]) { $message='
'.$langs->trans("NameNotDefined").'
'; $action="edit"; // Go back to create page + $error++; } if (! $_POST["login"]) { $message='
'.$langs->trans("LoginNotDefined").'
'; $action="edit"; // Go back to create page + $error++; } - if (! $message) + if (! $error) { $db->begin(); $object->fetch($id); $object->oldcopy=dol_clone($object); - $object->lastname = $_POST["nom"]; - $object->firstname = $_POST["prenom"]; - $object->login = $_POST["login"]; - $object->pass = $_POST["password"]; - $object->admin = $_POST["admin"]; - $object->office_phone = $_POST["office_phone"]; - $object->office_fax = $_POST["office_fax"]; - $object->user_mobile = $_POST["user_mobile"]; - $object->email = $_POST["email"]; - $object->job = $_POST["job"]; - $object->signature = $_POST["signature"]; - $object->openid = $_POST["openid"]; + $object->lastname = GETPOST("nom"); + $object->firstname = GETPOST("prenom"); + $object->login = GETPOST("login"); + $object->pass = GETPOST("password"); + $object->admin = GETPOST("admin"); + $object->office_phone=GETPOST("office_phone"); + $object->office_fax = GETPOST("office_fax"); + $object->user_mobile= GETPOST("user_mobile"); + $object->email = GETPOST("email"); + $object->job = GETPOST("job"); + $object->signature = GETPOST("signature"); + $object->openid = GETPOST("openid"); // Get extra fields foreach($_POST as $key => $value) @@ -363,8 +367,10 @@ if ($action == 'update' && ! $_POST["cancel"]) if (! empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); $ret=$object->update($user); + if ($ret < 0) { + $error++; if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); @@ -376,7 +382,36 @@ if ($action == 'update' && ! $_POST["cancel"]) } } - if ($ret >=0 && ! count($object->errors)) + if (! $error && isset($_POST['contactid'])) + { + $contactid=GETPOST('contactid'); + + if ($contactid > 0) + { + $contact=new Contact($db); + $contact->fetch($contactid); + + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; + $sql.= " SET fk_socpeople=".$contactid; + if ($contact->socid) $sql.=", fk_societe=".$contact->socid; + $sql.= " WHERE rowid=".$object->id; + } + else + { + $sql = "UPDATE ".MAIN_DB_PREFIX."user"; + $sql.= " SET fk_socpeople=NULL, fk_societe=NULL"; + $sql.= " WHERE rowid=".$object->id; + } + $resql=$db->query($sql); + dol_syslog("fiche::update sql=".$sql, LOG_DEBUG); + if (! $resql) + { + $error++; + $message.='
'.$db->lasterror().'
'; + } + } + + if (! $error && ! count($object->errors)) { if (GETPOST('deletephoto') && $object->photo) { @@ -415,7 +450,7 @@ if ($action == 'update' && ! $_POST["cancel"]) } } - if ($ret >= 0 && ! count($object->errors)) + if (! $error && ! count($object->errors)) { $message.='
'.$langs->trans("UserModified").'
'; $db->commit(); @@ -1149,20 +1184,20 @@ else // Type print ''.$langs->trans("Type").''; - if ($object->societe_id) - { - print $form->textwithpicto($langs->trans("External"),$langs->trans("InternalExternalDesc")); - } - else if ($object->ldap_sid) - { - print $langs->trans("DomainUser",$ldap->domainFQDN); - } - else - { - print $form->textwithpicto($langs->trans("Internal"),$langs->trans("InternalExternalDesc")); - } + $type=$langs->trans("Internal"); + if ($object->societe_id) $type=$langs->trans("External"); + print $form->textwithpicto($type,$langs->trans("InternalExternalDesc")); + if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; print ''."\n"; + // ldap sid + if ($object->ldap_sid) + { + print ''.$langs->trans("Type").''; + print $langs->trans("DomainUser",$ldap->domainFQDN); + print ''."\n"; + } + // Tel pro print ''.$langs->trans("PhonePro").''; print ''.dol_print_phone($object->office_phone,'',0,0,1).''; @@ -1630,6 +1665,7 @@ else print ''.$langs->trans("Administrator").''; if ($object->societe_id > 0) { + $langs->load("admin"); print ''; print ''.yn($object->admin); print ' ('.$langs->trans("ExternalUser").')'; @@ -1702,7 +1738,7 @@ else print ''; } - //Multicompany + // Multicompany if (! empty($conf->multicompany->enabled)) { if (empty($conf->multicompany->transverse_mode) && $conf->entity == 1 && $user->admin && ! $user->entity) @@ -1716,25 +1752,25 @@ else print ''; } } - else - { - // Type - print ''.$langs->trans("Type").''; - print ''; - if ($object->societe_id) - { - print $langs->trans("External"); - } - else if ($object->ldap_sid) - { - print $langs->trans("DomainUser"); - } - else - { - print $langs->trans("Internal"); - } - print ''; + + // Type + print ''.$langs->trans("Type").''; + print ''; + if ($user->id == $object->id || ! $user->admin) + { + $type=$langs->trans("Internal"); + if ($object->societe_id) $type=$langs->trans("External"); + print $form->textwithpicto($type,$langs->trans("InternalExternalDesc")); + if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; + } + else + { + $type=0; + if ($object->contact_id) $type=$object->contact_id; + print $form->selectcontacts(0,$type,'contactid',2,'','',1,'',false,1); + if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; } + print ''; // Tel pro print "".''.$langs->trans("PhonePro").''; diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 32de5b9d73c..15e6bd24801 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -27,7 +27,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/usergroups.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; $langs->load("users"); $langs->load("admin"); @@ -253,19 +254,22 @@ print $form->showrefnav($fuser,'id','',$user->rights->user->user->lire || $user- print ''; print ''."\n"; -// Nom +// Lastname print ''.$langs->trans("Lastname").''; print ''.$fuser->nom.''; print ''."\n"; -// Prenom +// Firstname print ''.$langs->trans("Firstname").''; print ''.$fuser->prenom.''; print ''."\n"; print '
'; -if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules")); +if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"), 0, 1).'
'; +// Show warning about external users +print showModulesExludedForExternal($modules).'
'."\n"; +print "
\n"; // For multicompany transversal mode if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) @@ -366,7 +370,7 @@ if ($result) print img_picto($langs->trans("Active"),'tick'); print ''; } - + else if (is_array($permsgroupbyentity[$entity])) { if (in_array($obj->id, $permsgroupbyentity[$entity])) // Permission own by group