FIX External user must not be able to edit its discounts

This commit is contained in:
Laurent Destailleur 2016-07-20 02:16:10 +02:00
parent 4382724b86
commit 01c140ecac

View File

@ -130,7 +130,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
} }
} }
if ($action == 'setremise') if ($action == 'setremise' && $user->rights->societe->creer)
{ {
//if ($user->rights->societe->creer) //if ($user->rights->societe->creer)
//if ($user->rights->facture->creer) //if ($user->rights->facture->creer)
@ -257,9 +257,15 @@ if ($socid > 0)
print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("CustomerAbsoluteDiscountAllUsers").'</td>';
print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>'; print '<td>'.$remise_all.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
if (! empty($user->fk_soc)) // No need to show this for external users
{
print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>'; print '<tr><td>'.$langs->trans("CustomerAbsoluteDiscountMy").'</td>';
print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>'; print '<td>'.$remise_user.'&nbsp;'.$langs->trans("Currency".$conf->currency).' '.$langs->trans("HT").'</td></tr>';
}
print '</table>'; print '</table>';
if ($user->rights->societe->creer)
{
print '<br>'; print '<br>';
print load_fiche_titre($langs->trans("NewGlobalDiscount"),'',''); print load_fiche_titre($langs->trans("NewGlobalDiscount"),'','');
@ -275,11 +281,14 @@ if ($socid > 0)
print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>'; print '<td><input type="text" size="60" name="desc" value="'.$_POST["desc"].'"></td></tr>';
print "</table>"; print "</table>";
}
print '</div>'; print '</div>';
dol_fiche_end(); dol_fiche_end();
if ($user->rights->societe->creer)
{
print '<div class="center">'; print '<div class="center">';
print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">'; print '<input type="submit" class="button" name="submit" value="'.$langs->trans("AddGlobalDiscount").'">';
if (! empty($backtopage)) if (! empty($backtopage))
@ -288,6 +297,7 @@ if ($socid > 0)
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">'; print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
} }
print '</div>'; print '</div>';
}
print '</form>'; print '</form>';
@ -414,7 +424,7 @@ if ($socid > 0)
print '<br>'; print '<br>';
/* /*
* Liste ristournes appliquees (=liees a une ligne de facture ou facture) * List discount consumed (=liees a une ligne de facture ou facture)
*/ */
// Remises liees a lignes de factures // Remises liees a lignes de factures