Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
legi
soft
gestex
Commits
18b51922
Commit
18b51922
authored
Jul 08, 2021
by
Gabriel Moreau
Browse files
Rename max_loan_day just max_day
parent
2fbd4fdd
Changes
5
Hide whitespace changes
Inline
Side-by-side
db-upgrade-4-5.sql
View file @
18b51922
...
...
@@ -8,8 +8,8 @@
--
ALTER
TABLE
`listing`
MODIFY
COLUMN
`barcode`
BIGINT
DEFAULT
NULL
;
ALTER
TABLE
`listing`
ADD
COLUMN
`max_
loan_
day`
INT
(
11
)
NOT
NULL
DEFAULT
0
;
UPDATE
`listing`
SET
`max_
loan_
day`
=
0
;
ALTER
TABLE
`listing`
ADD
COLUMN
`max_day`
INT
(
11
)
NOT
NULL
DEFAULT
0
;
UPDATE
`listing`
SET
`max_day`
=
0
;
-- TIMESTAMP =< MySQL 5.5.x < DATETIME
...
...
equipment-edit.php
View file @
18b51922
...
...
@@ -220,10 +220,10 @@ $team_chief_id = param_post_key('responsable', $equipment_selected, 0);
<tr>
<th>
Nombre de jour max pour un emprunt (0 = inderterminé)
Nombre de jour max pour un emprunt (0 = inderterminé
, max 90 jours
)
</th>
<td>
<input
type=
"number"
name=
"max
-loan-
day"
min=
"0"
max=
"90"
value=
"
<?=
param_post_key
(
'max_
loan_
day'
,
$equipment_selected
,
"0"
)
?>
"
required
>
<input
type=
"number"
name=
"max
_
day"
min=
"0"
max=
"90"
value=
"
<?=
param_post_key
(
'max_day'
,
$equipment_selected
,
0
)
?>
"
required
>
</td>
</tr>
...
...
equipment-process.php
View file @
18b51922
...
...
@@ -33,7 +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
);
$max_
day
=
param_post
(
'max
_
day'
,
0
);
$loanable
=
param_post
(
'loanable'
);
//variables ne pouvant etre nulles
if
(
empty
(
$categorie
))
...
...
@@ -75,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
,
$max_
loan_
day
);
list
(
$equipment_id
,
$err_msg
)
=
set_equipment_new
(
$pdo
,
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_day
);
if
(
$err_msg
!=
''
)
{
$message_alert
=
(
$logged_level
>
3
?
$err_msg
:
''
);
include_once
(
'include/alert-data.php'
);
...
...
@@ -119,11 +119,11 @@ if ( ($categorie != $equipment_selected['categorie'])
||
(
$notice
!=
$equipment_selected
[
'notice'
])
||
(
$barcode
!=
$equipment_selected
[
'barcode'
])
||
(
$loanable
!=
$equipment_selected
[
'loanable'
])
||
(
$max_
loan_day
!=
$equipment_selected
[
'max_
loan_
day'
]))
||
(
$max_
day
!=
$equipment_selected
[
'max_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
,
$max_
loan_
day
);
$err_msg
=
set_equipment_update
(
$pdo
,
$equipment_id
,
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_day
);
if
(
$err_msg
!=
''
)
{
$title
=
'Erreur appareil'
;
$action
=
'equipment-view.php?id='
.
$equipment_id
;
...
...
loan-process.php
View file @
18b51922
...
...
@@ -49,9 +49,9 @@ if ($param_mode == "loan" || $param_mode == "booking") {
$day_diff
=
$date_out_rtn
-
$date_out_ymd
;
$day_diff
=
intval
(
date
(
'd'
,
$day_diff
));
if
(
$loan_id
>
0
)
{
$equipment_max_day
=
get_equipment_all_by_id
(
$pdo
,
get_equipment_by_loan_id
(
$pdo
,
$loan_id
))[
"
max_
loan_
day
"
];
$equipment_max_day
=
get_equipment_all_by_id
(
$pdo
,
get_equipment_by_loan_id
(
$pdo
,
$loan_id
))[
'
max_day
'
];
}
else
{
$equipment_max_day
=
get_equipment_all_by_id
(
$pdo
,
$equipment_id
)[
"
max_
loan_
day
"
];
$equipment_max_day
=
get_equipment_all_by_id
(
$pdo
,
$equipment_id
)[
'
max_day
'
];
}
if
(
$equipment_max_day
!=
0
)
{
if
(
$day_diff
>
$equipment_max_day
)
...
...
module/db-functions.php
View file @
18b51922
...
...
@@ -503,11 +503,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
,
$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)'
;
function
set_equipment_new
(
$pdo
,
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_day
)
{
$sql
=
'INSERT INTO Listing (categorie, nom, modele, gamme, equipe, fournisseur, achat, responsable, reparation, accessoires, inventaire, notice, barcode, loanable, max_day)'
;
$sql
.
=
' VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);'
;
$stmt
=
$pdo
->
prepare
(
$sql
);
$iostat
=
$stmt
->
execute
(
array
(
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_
loan_
day
));
$iostat
=
$stmt
->
execute
(
array
(
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_day
));
$err_msg
=
''
;
if
(
!
$iostat
)
$err_msg
=
$stmt
->
errorInfo
()[
2
];
...
...
@@ -522,10 +522,10 @@ function set_equipment_new($pdo, $categorie, $nom, $modele, $feature, $equipe, $
* @return string Renvoie une chaine vide
* si réussite sinon une chaine d'erreurs
*/
function
set_equipment_update
(
$pdo
,
$equipment_id
,
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_
loan_
day
)
{
$sql
=
'UPDATE Listing SET categorie = ?, nom = ?, modele = ?, gamme = ?, equipe = ?, fournisseur = ?, achat = ?, responsable = ?, reparation = ?, accessoires = ?, inventaire = ?, notice = ?, barcode = ?, loanable = ?, max_
loan_
day = ? WHERE id = ?;)'
;
function
set_equipment_update
(
$pdo
,
$equipment_id
,
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_day
)
{
$sql
=
'UPDATE Listing SET categorie = ?, nom = ?, modele = ?, gamme = ?, equipe = ?, fournisseur = ?, achat = ?, responsable = ?, reparation = ?, accessoires = ?, inventaire = ?, notice = ?, barcode = ?, loanable = ?, max_day = ? WHERE id = ?;)'
;
$stmt
=
$pdo
->
prepare
(
$sql
);
$iostat
=
$stmt
->
execute
(
array
(
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_
loan_
day
,
$equipment_id
));
$iostat
=
$stmt
->
execute
(
array
(
$categorie
,
$nom
,
$modele
,
$feature
,
$equipe
,
$fourn
,
$achat
,
$tech
,
$reparation
,
$accessoires
,
$inventaire
,
$notice
,
$barcode
,
$loanable
,
$max_day
,
$equipment_id
));
$err_msg
=
''
;
if
(
!
$iostat
)
$err_msg
=
$stmt
->
errorInfo
()[
2
];
...
...
Write
Preview
Markdown
is supported
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