Changeset 107665 in spip-zone
- Timestamp:
- Nov 20, 2017, 6:18:20 PM (3 years ago)
- Location:
- _plugins_/stocks/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/stocks/trunk/stocks_administrations.php
r107611 r107665 9 9 10 10 // Sécurité 11 if (!defined( "_ECRIRE_INC_VERSION")) {11 if (!defined('_ECRIRE_INC_VERSION')) { 12 12 return; 13 13 } 14 15 14 16 15 /** … … 35 34 include_spip('base/upgrade'); 36 35 maj_plugin($nom_meta_base_version, $version_cible, $maj); 37 38 36 } 39 40 41 37 42 38 /** -
_plugins_/stocks/trunk/stocks_fonctions.php
r107615 r107665 2 2 3 3 // Sécurité 4 if (!defined( "_ECRIRE_INC_VERSION")) {4 if (!defined('_ECRIRE_INC_VERSION')) { 5 5 return; 6 6 } … … 10 10 // Retourner une quantie pour l'objet en cours 11 11 function balise_QUANTITE_dist($p) { 12 if (!$_objet = interprete_argument_balise(1, $p)){12 if (!$_objet = interprete_argument_balise(1, $p)) { 13 13 $_objet = objet_type($p->type_requete); 14 $_id = champ_sql($p->boucles[$p->id_boucle]->primary,$p); 14 $_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p); 15 } else { 16 $_id = interprete_argument_balise(2, $p); 15 17 } 16 else {17 $_id = interprete_argument_balise(2,$p);18 }19 18 20 $p->code = "quantite_champ_ou_stock(".champ_sql('quantite', $p).",".sql_quote($_objet).",$_id)";21 22 19 $p->code = 'quantite_champ_ou_stock('.champ_sql('quantite', $p).','.sql_quote($_objet).',$_id)'; 20 $p->interdire_scripts = false; 21 23 22 return $p; 24 23 } 25 24 26 27 function quantite_champ_ou_stock($quantite,$objet,$id_objet) { 28 include_spip('inc/stocks'); 29 if (is_null($quantite)){ 30 return get_quantite($objet,$id_objet); 31 } 32 else { 33 spip_log($quantite,'stocks'); 34 return $quantite; 35 } 25 function quantite_champ_ou_stock($quantite, $objet, $id_objet) { 26 include_spip('inc/stocks'); 27 if (is_null($quantite)) { 28 return get_quantite($objet, $id_objet); 29 } else { 30 spip_log($quantite, 'stocks'); 31 return $quantite; 32 } 36 33 } 37 -
_plugins_/stocks/trunk/stocks_pipelines.php
r107637 r107665 2 2 3 3 // Sécurité 4 if (!defined( "_ECRIRE_INC_VERSION")) {4 if (!defined('_ECRIRE_INC_VERSION')) { 5 5 return; 6 6 } … … 8 8 function stocks_formulaire_charger($flux) { 9 9 10 10 $form = $flux['args']['form']; 11 11 12 if ($form == "editer_produit"){12 if ($form == 'editer_produit') { 13 13 $stock_default = lire_config('stocks/quantite_default'); 14 15 16 $quantite = get_quantite("produit",$id_produit);14 include_spip('inc/stocks'); 15 $id_produit = intval($flux['args']['args'][0]); 16 $quantite = get_quantite('produit', $id_produit); 17 17 18 19 20 21 22 23 'label'=> 'Stock' 24 25 26 27 28 29 30 31 32 33 34 ) 35 36 37 38 18 // La quantité produit 19 $flux['data']['_saisies'][] = array( 20 'saisie' => 'fieldset', 21 'options' => array( 22 'nom' => 'stocks', 23 'label'=> 'Stock' 24 ), 25 'saisies'=> array( 26 array( 27 'saisie' => 'input', 28 'options' => array( 29 'nom' => 'quantite_produit', 30 'label' => '<:stocks:quantite_produit:>', 31 'defaut' => isset($quantite) ? $quantite : $stock_default 32 ) 33 ) 34 ) 35 ); 36 } 37 38 return $flux; 39 39 } 40 40 41 function stocks_formulaire_traiter($flux) { 41 function stocks_formulaire_traiter($flux) 42 { 42 43 43 44 $form = $flux['args']['form']; 44 45 45 if($form == "editer_produit"){46 47 46 if($form == "editer_produit") { 47 include_spip('inc/stocks'); 48 $id_produit = $flux['data']['id_produit']; 48 49 $quantite = intval(_request('quantite_produit')); 49 50 50 51 set_quantite("produit",$id_produit,$quantite);52 53 54 51 //spip_log("$id_produit",'stocks'); 52 set_quantite("produit", $id_produit, $quantite); 53 } 54 55 return $flux; 55 56 } 56 57 … … 60 61 */ 61 62 62 function stocks_afficher_fiche_objet($flux) { 63 function stocks_afficher_fiche_objet($flux) 64 { 63 65 64 if($flux['args']['type'] == 'produit') {66 if($flux['args']['type'] == 'produit') { 65 67 66 68 $objet = $flux['args']['type']; … … 70 72 'prive/squelettes/inclure/stock_fiche_objet', 71 73 array( 72 73 74 'objet'=>$objet, 75 'id_objet'=>$id_objet 74 76 ) 75 77 ); … … 86 88 87 89 88 function stocks_pre_boucle($boucle) { 89 //Connaitre la table en cours 90 // $id_table = $boucle->id_table; 91 // 92 // //Savoir si on consulté la table organisations_liens 93 // if ($jointure = array_keys($boucle->from, 'spip_stocks')) { 94 // //Vérifier qu'on est bien dans le cas d'une jointure automatique 95 // if (isset($boucle->join[$jointure[0]]) 96 // and isset($boucle->join[$jointure[0]][3]) 97 // and $boucle->join[$jointure[0]] 98 // and $boucle->join[$jointure[0]][3] 99 // ) { 100 // //Le critere ON de la jointure (index 3 dans le tableau de jointure) est incompléte 101 // //on fait en sorte de retomber sur ses pattes, en indiquant l'objet à joindre 102 // $boucle->join[$jointure[0]][3] = "'L1.objet='.sql_quote('".objet_type($id_table)."')"; 103 // } 104 // } 90 function stocks_pre_boucle($boucle) 91 { 92 //Connaitre la table en cours 93 // $id_table = $boucle->id_table; 94 // 95 // //Savoir si on consulté la table organisations_liens 96 // if ($jointure = array_keys($boucle->from, 'spip_stocks')) { 97 // //Vérifier qu'on est bien dans le cas d'une jointure automatique 98 // if (isset($boucle->join[$jointure[0]]) 99 // and isset($boucle->join[$jointure[0]][3]) 100 // and $boucle->join[$jointure[0]] 101 // and $boucle->join[$jointure[0]][3] 102 // ) { 103 // //Le critere ON de la jointure (index 3 dans le tableau de jointure) est incompléte 104 // //on fait en sorte de retomber sur ses pattes, en indiquant l'objet à joindre 105 // $boucle->join[$jointure[0]][3] = "'L1.objet='.sql_quote('".objet_type($id_table)."')"; 106 // } 107 // } 105 108 106 109 return $boucle; 107 110 } 108 111
Note: See TracChangeset
for help on using the changeset viewer.