|
|
|
@ -25,9 +25,20 @@ function formulaires_panier_produit_options_charger_dist($id_produit) {
|
|
|
|
|
|
|
|
|
|
function formulaires_panier_produit_options_verifier_dist($id_produit) { |
|
|
|
|
$erreurs = array(); |
|
|
|
|
$groupes = sql_allfetsel('id_optionsgroupe, obligatoire', 'spip_optionsgroupes'); |
|
|
|
|
if ($id_objet = intval(_request('id_produit'))) { |
|
|
|
|
$objet = 'produit'; |
|
|
|
|
} else { |
|
|
|
|
$id_objet = intval(_request('id_objet')); |
|
|
|
|
$objet = _request('objet'); |
|
|
|
|
} |
|
|
|
|
$groupes = sql_allfetsel('id_optionsgroupe, obligatoire', 'spip_optionsgroupes', 'obligatoire = 1'); |
|
|
|
|
foreach ($groupes as $groupe) { |
|
|
|
|
if ($groupe['obligatoire'] && !_request('id_option' . $groupe['id_optionsgroupe'])) { |
|
|
|
|
$options_groupes = sql_allfetsel( |
|
|
|
|
'o.id_option', |
|
|
|
|
'spip_options o join spip_options_liens ol using(id_option)', |
|
|
|
|
'o.id_optionsgroupe = '.$groupe['id_optionsgroupe'].' and ol.objet = '.sql_quote($objet).' and ol.id_objet = '.$id_objet |
|
|
|
|
); |
|
|
|
|
if ($options_groupes && !_request('id_option' . $groupe['id_optionsgroupe'])) { |
|
|
|
|
$erreurs['id_groupe' . $groupe['id_optionsgroupe']] = _T('optionsgroupe:erreur_groupe_obligatoire'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|