Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
legi
soft
gestex
Commits
4dacf181
Commit
4dacf181
authored
Jul 07, 2021
by
Estéban Ristich
Browse files
Fix Issue
#69
save max day in database
parent
01a82fa4
Changes
2
Hide whitespace changes
Inline
Side-by-side
equipment-process.php
View file @
4dacf181
...
...
@@ -33,6 +33,7 @@ $reparation = param_post('reparation');
$accessoires
=
param_post
(
'accessoires'
);
$inventaire
=
param_post
(
'inventaire'
);
$barcode
=
param_post
(
'barcode'
);
$max_loan_day
=
param_post
(
'max-loan-day'
,
0
);
$loanable
=
param_post
(
'loanable'
);
//variables ne pouvant etre nulles
if
(
empty
(
$categorie
))
...
...
@@ -74,7 +75,7 @@ if (!empty($erreur)) {
$pdo
=
connect_db_or_alert
();
if
(
$flag_new
)
{
// new
list
(
$equipment_id
,
$err_msg
)
=
set_equipment_new
(
$pdo
,
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
);
list
(
$equipment_id
,
$err_msg
)
=
set_equipment_new
(
$pdo
,
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_loan_day
);
if
(
$err_msg
!=
''
)
{
$message_alert
=
(
$logged_level
>
3
?
$err_msg
:
''
);
include_once
(
'include/alert-data.php'
);
...
...
@@ -117,11 +118,12 @@ if ( ($categorie != $equipment_selected['categorie'])
||
(
$inventaire
!=
$equipment_selected
[
'inventaire'
])
||
(
$notice
!=
$equipment_selected
[
'notice'
])
||
(
$barcode
!=
$equipment_selected
[
'barcode'
])
||
(
$loanable
!=
$equipment_selected
[
'loanable'
]))
||
(
$loanable
!=
$equipment_selected
[
'loanable'
])
||
(
$max_loan_day
!=
$equipment_selected
[
'max_loan_day'
]))
$modif
=
true
;
if
(
$modif
)
{
$err_msg
=
set_equipment_update
(
$pdo
,
$equipment_id
,
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
);
$err_msg
=
set_equipment_update
(
$pdo
,
$equipment_id
,
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$max_loan_day
,
$loanable
);
if
(
$err_msg
!=
''
)
{
$title
=
'Erreur appareil'
;
$action
=
'equipment-view.php?id='
.
$equipment_id
;
...
...
module/db-functions.php
View file @
4dacf181
...
...
@@ -523,11 +523,11 @@ function get_equipment_by_loan_id($pdo, $loan_id) {
* @return array|string Renvoie une chaine si echec sinon
* un tableau avec l'ID et un msg d'erreur eventuellement
*/
function
set_equipment_new
(
$pdo
,
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$max_loan_day
,
$loanable
)
{
$sql
=
'INSERT INTO Listing (categorie, nom, modele, gamme, equipe, fournisseur, achat, responsable, reparation, accessoires, inventaire, notice, barcode, max_loan_day
, loanable
)'
;
$sql
.
=
' VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
?);'
;
function
set_equipment_new
(
$pdo
,
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_loan_day
)
{
$sql
=
'INSERT INTO Listing (categorie, nom, modele, gamme, equipe, fournisseur, achat, responsable, reparation, accessoires, inventaire, notice, barcode,
loanable,
max_loan_day)'
;
$sql
.
=
' VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
,
?);'
;
$stmt
=
$pdo
->
prepare
(
$sql
);
$iostat
=
$stmt
->
execute
(
array
(
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$max_loan_day
,
$loanable
));
$iostat
=
$stmt
->
execute
(
array
(
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_loan_day
));
$err_msg
=
''
;
if
(
!
$iostat
)
$err_msg
=
$stmt
->
errorInfo
()[
2
];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment