diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 4e1d3be899a..aeaa0ad5eab 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -58,14 +58,14 @@ if ($user->societe_id > 0) // Protection restriction commercial if (!$user->rights->commercial->client->voir && $socidp && !$user->societe_id > 0) { - $sql = "SELECT sc.fk_soc, s.client"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE sc.fk_soc = ".$socidp." AND sc.fk_user = ".$user->id." AND s.client = 1"; - - if ( $db->query($sql) ) - { - if ( $db->num_rows() == 0) accessforbidden(); - } + $sql = "SELECT sc.fk_soc, s.client"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."societe as s"; + $sql .= " WHERE sc.fk_soc = ".$socidp." AND sc.fk_user = ".$user->id." AND s.client = 1"; + + if ( $db->query($sql) ) + { + if ( $db->num_rows() == 0) accessforbidden(); + } } @@ -81,7 +81,7 @@ if ($_GET["action"] == 'attribute_prefix') $societe->attribute_prefix($db, $_GET["socid"]); } // conditions de règlement -if ($_POST["action"] == 'setconditions' && (!$user->societe_id > 0)) +if ($_POST["action"] == 'setconditions' && $user->rights->societe->creer) { $societe = new Societe($db, $_GET["socid"]); @@ -92,7 +92,7 @@ if ($_POST["action"] == 'setconditions' && (!$user->societe_id > 0)) if (! $result) dolibarr_print_error($result); } // mode de règlement -if ($_POST["action"] == 'setmode' && (!$user->societe_id > 0)) +if ($_POST["action"] == 'setmode' && $user->rights->societe->creer) { $societe = new Societe($db, $_GET["socid"]); $societe->mode_reglement=$_POST['mode_reglement_id']; @@ -102,7 +102,7 @@ if ($_POST["action"] == 'setmode' && (!$user->societe_id > 0)) if (! $result) dolibarr_print_error($result); } // assujétissement à la TVA -if ($_POST["action"] == 'setassujtva' && (!$user->societe_id > 0)) +if ($_POST["action"] == 'setassujtva' && $user->rights->societe->creer) { $societe = new Societe($db, $_GET["socid"]); $societe->tva_assuj=$_POST['assujtva_value']; @@ -247,7 +247,7 @@ if ($socidp > 0) print ''; + if (($_GET['action'] != 'editconditions') && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('PaymentConditions'); print ''; - if (($_GET['action'] != 'editconditions') && (!$user->societe_id > 0)) print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print ''; if ($_GET['action'] == 'editconditions') @@ -266,7 +266,7 @@ if ($socidp > 0) print ''; + if (($_GET['action'] != 'editmode') && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('PaymentMode'); print ''; - if (($_GET['action'] != 'editmode') && (!$user->societe_id > 0)) print 'id.'">'.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; print ''; if ($_GET['action'] == 'editmode') @@ -285,7 +285,7 @@ if ($socidp > 0) print '"; print ''; @@ -336,10 +336,10 @@ if ($socidp > 0) print '
'; print $langs->trans("CustomerRelativeDiscountShort"); print ''; - if (!$user->societe_id > 0) + if ($user->rights->societe->creer) { print ''.img_edit($langs->trans("Modify")).''; } @@ -299,7 +299,7 @@ if ($socidp > 0) print '
'; print $langs->trans("CustomerAbsoluteDiscountShort"); print ''; - if (!$user->societe_id > 0) + if ($user->rights->societe->creer) { print ''.img_edit($langs->trans("Modify")).''; } @@ -320,10 +320,10 @@ if ($socidp > 0) print '
'; print $langs->trans("PriceLevel"); print ''; - if (!$user->societe_id > 0) - { - print ''.img_edit($langs->trans("Modify")).''; - } + if ($user->rights->societe->creer) + { + print ''.img_edit($langs->trans("Modify")).''; + } print '
'; print '
'.$objsoc->price_level."
'; print $langs->trans("DeliveriesAddress"); print ''; - if (!$user->societe_id > 0) - { - print ''.img_edit($langs->trans("Modify")).''; - } + if ($user->rights->societe->creer) + { + print ''.img_edit($langs->trans("Modify")).''; + } print '
'; print '';