diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index e7568331c7d..6871a1823db 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2005-2010 Regis Houssin + * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2011 Herve Prot * * This program is free software; you can redistribute it and/or modify @@ -69,6 +69,52 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("DefaultRightsDesc"); print " ".$langs->trans("OnlyActiveElementsAreShown")."
\n"; +$db->begin(); + +// Charge les modules soumis a permissions +$modules = array(); +$modulesdir = dolGetModulesDirs(); + +foreach ($modulesdir as $dir) +{ + // Load modules attributes in arrays (name, numero, orders) from dir directory + //print $dir."\n
"; + $handle=@opendir(dol_osencode($dir)); + if (is_resource($handle)) + { + while (($file = readdir($handle))!==false) + { + if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') + { + $modName = substr($file, 0, dol_strlen($file) - 10); + if ($modName) + { + include_once $dir.$file; + $objMod = new $modName($db); + + // Load all lang files of module + if (isset($objMod->langfiles) && is_array($objMod->langfiles)) + { + foreach($objMod->langfiles as $domain) + { + $langs->load($domain); + } + } + // Load all permissions + if ($objMod->rights_class) + { + $ret=$objMod->insert_permissions(0); + $modules[$objMod->rights_class]=$objMod; + //print "modules[".$objMod->rights_class."]=$objMod;"; + } + } + } + } + } +} + +$db->commit(); + // Show warning about external users print showModulesExludedForExternal($modules).'
'."\n"; print "
\n"; @@ -81,54 +127,6 @@ dol_fiche_head($head, 'default', $langs->trans("Security")); print ''; - -$db->begin(); - -// Charge les modules soumis a permissions -$modules = array(); -$modulesdir = dolGetModulesDirs(); - -foreach ($modulesdir as $dir) -{ - // Load modules attributes in arrays (name, numero, orders) from dir directory - //print $dir."\n
"; - $handle=@opendir(dol_osencode($dir)); - if (is_resource($handle)) - { - while (($file = readdir($handle))!==false) - { - if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') - { - $modName = substr($file, 0, dol_strlen($file) - 10); - - if ($modName) - { - include_once $dir.$file; - $objMod = new $modName($db); - - // Load all lang files of module - if (isset($objMod->langfiles) && is_array($objMod->langfiles)) - { - foreach($objMod->langfiles as $domain) - { - $langs->load($domain); - } - } - // Load all permissions - if ($objMod->rights_class) - { - $ret=$objMod->insert_permissions(0); - $modules[$objMod->rights_class]=$objMod; - //print "modules[".$objMod->rights_class."]=$objMod;"; - } - } - } - } - } -} - -$db->commit(); - // Affiche lignes des permissions $sql = "SELECT r.id, r.libelle, r.module, r.perms, r.subperms, r.bydefault"; $sql.= " FROM ".MAIN_DB_PREFIX."rights_def as r"; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 463f1c0f288..33993771102 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -660,11 +660,10 @@ function createOrder($authentication,$order) $newline->fk_product=$line['fk_product']; $newline->tva_tx=$line['vat_rate']; $newline->qty=$line['qty']; - $newline->subprice=$line['unitprice']; + $newline->subprice=$line['subprice']; $newline->total_ht=$line['total_net']; $newline->total_tva=$line['total_vat']; $newline->total_ttc=$line['total']; - $newline->fk_product=$line['fk_product']; $newobject->lines[]=$newline; }