évolution code pour version 1.3 de paheko
correction décalage date affichée
This commit is contained in:
parent
d46d7b00dc
commit
b236ef5f71
|
@ -10,15 +10,12 @@ use Paheko\Utils;
|
||||||
|
|
||||||
$csrf_key = 'cat_create';
|
$csrf_key = 'cat_create';
|
||||||
|
|
||||||
if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
$form->runIf(f('save') && !$form->hasErrors(), function() use ($cat, $form) {
|
||||||
{
|
try {
|
||||||
// try to add new category and if error catched add it in form
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$cat->add([
|
$cat->add([
|
||||||
'name' => ucfirst(f('name'))
|
'name' => ucfirst(f('name'))
|
||||||
]);
|
]);
|
||||||
Utils::redirect(PLUGIN_URL . 'categories/index.php');
|
Utils::redirect(Utils::getSelfURL());
|
||||||
}
|
}
|
||||||
catch (\RuntimeException $e)
|
catch (\RuntimeException $e)
|
||||||
{
|
{
|
||||||
|
@ -30,7 +27,8 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
$form->addError($e->getMessage());
|
$form->addError($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}, $csrf_key);
|
||||||
|
|
||||||
// get the list of all categories and send it to template
|
// get the list of all categories and send it to template
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ $eqmt = new Equipment;
|
||||||
|
|
||||||
list($eqmts_owned, $eqmts_no_owned, $eqmts_just_listed) = $eqmt->AllListsAll($eqmts);
|
list($eqmts_owned, $eqmts_no_owned, $eqmts_just_listed) = $eqmt->AllListsAll($eqmts);
|
||||||
|
|
||||||
$return_link = PLUGIN_URL . 'categories/index.php';
|
$return_link = Utils::plugin_url() . 'categories/index.php';
|
||||||
|
|
||||||
// send to template the category's name and all lists of its equipment
|
// send to template the category's name and all lists of its equipment
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,8 @@ if (!$cat_requested) {
|
||||||
// check if edit form is submitted
|
// check if edit form is submitted
|
||||||
$csrf_key = 'edit_category_' . $cat_requested->id;
|
$csrf_key = 'edit_category_' . $cat_requested->id;
|
||||||
|
|
||||||
if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
$form->runIf(f('save') && !$form->hasErrors(),
|
||||||
|
function() use($cat, $cat_requested, $form)
|
||||||
{
|
{
|
||||||
// try to edit category selected and if error catched add it in form
|
// try to edit category selected and if error catched add it in form
|
||||||
try
|
try
|
||||||
|
@ -26,7 +27,7 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
$cat->edit($cat_requested->id, [
|
$cat->edit($cat_requested->id, [
|
||||||
'name' => ucfirst(f('name'))
|
'name' => ucfirst(f('name'))
|
||||||
]);
|
]);
|
||||||
Utils::redirect(PLUGIN_URL . 'categories/index.php');
|
Utils::redirect(Utils::plugin_url() . 'categories/index.php');
|
||||||
}
|
}
|
||||||
catch (\RuntimeException $e)
|
catch (\RuntimeException $e)
|
||||||
{
|
{
|
||||||
|
@ -38,9 +39,9 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
$form->addError($e->getMessage());
|
$form->addError($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
$cancel_link = PLUGIN_URL . 'categories/index.php';
|
$cancel_link = Utils::plugin_url() . 'categories/index.php';
|
||||||
|
|
||||||
// send all to template
|
// send all to template
|
||||||
$tpl->assign(compact('cat_requested', 'csrf_key', 'cancel_link'));
|
$tpl->assign(compact('cat_requested', 'csrf_key', 'cancel_link'));
|
||||||
|
|
|
@ -18,13 +18,14 @@ if (!$cat_requested) {
|
||||||
|
|
||||||
$csrf_key = 'delete_category_' . $cat_requested->id;
|
$csrf_key = 'delete_category_' . $cat_requested->id;
|
||||||
|
|
||||||
if (f('delete') && $form->check($csrf_key) && !$form->hasErrors())
|
$form->runIf(f('delete') && !$form->hasErrors(),
|
||||||
|
function() use ($cat, $cat_requested, $form)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// try to delete category selected and if error catched add it in form
|
// try to delete category selected and if error catched add it in form
|
||||||
$cat->delete($cat_requested->id);
|
$cat->delete($cat_requested->id);
|
||||||
Utils::redirect(PLUGIN_URL . 'categories/index.php');
|
Utils::redirect(Utils::plugin_url() . 'categories/index.php');
|
||||||
}
|
}
|
||||||
catch (\RuntimeException $e)
|
catch (\RuntimeException $e)
|
||||||
{
|
{
|
||||||
|
@ -36,9 +37,9 @@ if (f('delete') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
$form->addError($e->getMessage());
|
$form->addError($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
$cancel_link = PLUGIN_URL . 'categories/index.php';
|
$cancel_link = Utils::plugin_url() . 'categories/index.php';
|
||||||
|
|
||||||
// send to template the category requested
|
// send to template the category requested
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ $eqmt_cat = $cat->get($eqmt_requested->category_id);
|
||||||
$eqmt_requested->category = $eqmt_cat->name;
|
$eqmt_requested->category = $eqmt_cat->name;
|
||||||
$mvts = $mvt->AllEqmtMovements($eqmt_requested->id);
|
$mvts = $mvt->AllEqmtMovements($eqmt_requested->id);
|
||||||
|
|
||||||
$return_link = PLUGIN_URL . 'index.php';
|
$return_link = Utils::plugin_url() . 'index.php';
|
||||||
|
|
||||||
// send all to template
|
// send all to template
|
||||||
$tpl->assign(compact('eqmt_requested', 'mvts', 'return_link'));
|
$tpl->assign(compact('eqmt_requested', 'mvts', 'return_link'));
|
||||||
|
|
|
@ -26,7 +26,8 @@ $selected_cat = $eqmt_requested->category_id;
|
||||||
// check if edit form is submitted
|
// check if edit form is submitted
|
||||||
$csrf_key = 'edit_equipment_' . $eqmt_requested->id;
|
$csrf_key = 'edit_equipment_' . $eqmt_requested->id;
|
||||||
|
|
||||||
if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
$form->runIf (f('save') && !$form->hasErrors(),
|
||||||
|
function () use ($eqmt, $eqmt_requested)
|
||||||
{
|
{
|
||||||
// try to edit equipment selected and if error catched add it in form
|
// try to edit equipment selected and if error catched add it in form
|
||||||
try
|
try
|
||||||
|
@ -35,7 +36,7 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
'category_id' => (int) f('category_id'),
|
'category_id' => (int) f('category_id'),
|
||||||
'designation' => ucfirst(strtolower(f('designation'))),
|
'designation' => ucfirst(strtolower(f('designation'))),
|
||||||
]);
|
]);
|
||||||
Utils::redirect(PLUGIN_URL . 'index.php');
|
Utils::redirect(Utils::plugin_url() . 'index.php');
|
||||||
}
|
}
|
||||||
catch (\RuntimeException $e)
|
catch (\RuntimeException $e)
|
||||||
{
|
{
|
||||||
|
@ -47,9 +48,9 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
$form->addError($e->getMessage());
|
$form->addError($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
$cancel_link = PLUGIN_URL . 'index.php';
|
$cancel_link = Utils::plugin_url() . 'index.php';
|
||||||
|
|
||||||
// send all to template
|
// send all to template
|
||||||
$tpl->assign(compact('eqmt_requested', 'cats', 'selected_cat', 'csrf_key', 'cancel_link'));
|
$tpl->assign(compact('eqmt_requested', 'cats', 'selected_cat', 'csrf_key', 'cancel_link'));
|
||||||
|
|
|
@ -22,7 +22,8 @@ $selected_cat = $cats[0]->id;
|
||||||
// check if add form is submitted
|
// check if add form is submitted
|
||||||
$csrf_key = 'add_entry';
|
$csrf_key = 'add_entry';
|
||||||
|
|
||||||
if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
$form->runIf(f('save') && !$form->hasErrors(),
|
||||||
|
function () use ($mvt, $form)
|
||||||
{
|
{
|
||||||
// try to add new equipment, get his id, add new entry
|
// try to add new equipment, get his id, add new entry
|
||||||
// and if error catched add it in form
|
// and if error catched add it in form
|
||||||
|
@ -46,7 +47,7 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
'mvt_date' => $mvt_date_format,
|
'mvt_date' => $mvt_date_format,
|
||||||
'additional_comment' => f('additional_comment'),
|
'additional_comment' => f('additional_comment'),
|
||||||
]);
|
]);
|
||||||
Utils::redirect(PLUGIN_URL . 'mouvements/entrees/index.php');
|
Utils::redirect(Utils::plugin_url() . 'mouvements/entrees/index.php');
|
||||||
}
|
}
|
||||||
catch (\RuntimeException $e)
|
catch (\RuntimeException $e)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +62,7 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
$selected_kind = f('kind');
|
$selected_kind = f('kind');
|
||||||
$selected_cat = f('category_id');
|
$selected_cat = f('category_id');
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// make default date (now)
|
// make default date (now)
|
||||||
$default_date = new \DateTime;
|
$default_date = new \DateTime;
|
||||||
|
@ -71,7 +72,7 @@ $comment_placeholder = "ex: don reçu de la part de...";
|
||||||
|
|
||||||
// make cancel link, legend for the title of the form
|
// make cancel link, legend for the title of the form
|
||||||
// and the template name for equipment to use in form
|
// and the template name for equipment to use in form
|
||||||
$cancel_link = PLUGIN_URL . 'mouvements/entrees/index.php';
|
$cancel_link = Utils::plugin_url() . 'mouvements/entrees/index.php';
|
||||||
$legend_part = "non répertorié";
|
$legend_part = "non répertorié";
|
||||||
$tpl_materiel_name = "non_repertorie";
|
$tpl_materiel_name = "non_repertorie";
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,8 @@ use Paheko\Utils;
|
||||||
// check if add form is submitted
|
// check if add form is submitted
|
||||||
$csrf_key = 'add_entry';
|
$csrf_key = 'add_entry';
|
||||||
|
|
||||||
if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
$form->runIf(f('save') && !$form->hasErrors(),
|
||||||
|
function () use ($mvt)
|
||||||
{
|
{
|
||||||
// make the entry date in the good format
|
// make the entry date in the good format
|
||||||
$mvt_date_format = date_create_from_format(
|
$mvt_date_format = date_create_from_format(
|
||||||
|
@ -26,8 +27,8 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
'mvt_date' => $mvt_date_format,
|
'mvt_date' => $mvt_date_format,
|
||||||
'additional_comment' => f('additional_comment'),
|
'additional_comment' => f('additional_comment'),
|
||||||
]);
|
]);
|
||||||
Utils::redirect(PLUGIN_URL . 'mouvements/entrees/index.php');
|
Utils::redirect(Utils::plugin_url() . 'mouvements/entrees/index.php');
|
||||||
}
|
});
|
||||||
|
|
||||||
// get the list of all equipments ordered by category
|
// get the list of all equipments ordered by category
|
||||||
$eqmt = new Equipment;
|
$eqmt = new Equipment;
|
||||||
|
@ -45,7 +46,7 @@ $comment_placeholder = "ex: don reçu de la part de...";
|
||||||
|
|
||||||
// make cancel link, legend for the title of the form
|
// make cancel link, legend for the title of the form
|
||||||
// and the template name for equipment to use in form
|
// and the template name for equipment to use in form
|
||||||
$cancel_link = PLUGIN_URL . 'mouvements/entrees/index.php';
|
$cancel_link = Utils::plugin_url() . 'mouvements/entrees/index.php';
|
||||||
$legend_part = "répertorié";
|
$legend_part = "répertorié";
|
||||||
$tpl_materiel_name = "repertorie";
|
$tpl_materiel_name = "repertorie";
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@ $selected_eqmt = "";
|
||||||
// check if add form is submitted
|
// check if add form is submitted
|
||||||
$csrf_key = 'add_entry';
|
$csrf_key = 'add_entry';
|
||||||
|
|
||||||
if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
$form->runIf(f('save') && !$form->hasErrors(),
|
||||||
|
function() use ($mvt, $eqmt, $selected_eqmt, $form)
|
||||||
{
|
{
|
||||||
$eqmt_id = f('equipment_id');
|
$eqmt_id = f('equipment_id');
|
||||||
$eqmt_number = (int) f('equipment_number');
|
$eqmt_number = (int) f('equipment_number');
|
||||||
|
@ -35,7 +36,7 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
'mvt_date' => $mvt_date_format,
|
'mvt_date' => $mvt_date_format,
|
||||||
'additional_comment' => f('additional_comment'),
|
'additional_comment' => f('additional_comment'),
|
||||||
]);
|
]);
|
||||||
Utils::redirect(PLUGIN_URL . 'mouvements/entrees/index.php');
|
Utils::redirect(Utils::plugin_url() . 'mouvements/entrees/index.php');
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// not possible, add error to form
|
// not possible, add error to form
|
||||||
|
@ -45,7 +46,7 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
// keep the datas submitted as selected
|
// keep the datas submitted as selected
|
||||||
$selected_eqmt = $eqmt_id;
|
$selected_eqmt = $eqmt_id;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// make default date (now)
|
// make default date (now)
|
||||||
$default_date = new \DateTime;
|
$default_date = new \DateTime;
|
||||||
|
@ -55,7 +56,7 @@ $comment_placeholder = "ex: retour de prêt...";
|
||||||
|
|
||||||
// make cancel link, legend for the title of the form
|
// make cancel link, legend for the title of the form
|
||||||
// and the template name for equipment to use in form
|
// and the template name for equipment to use in form
|
||||||
$cancel_link = PLUGIN_URL . 'mouvements/entrees/index.php';
|
$cancel_link = Utils::plugin_url() . 'mouvements/entrees/index.php';
|
||||||
$legend_part = "en retour de location / prêt";
|
$legend_part = "en retour de location / prêt";
|
||||||
$tpl_materiel_name = "retour";
|
$tpl_materiel_name = "retour";
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,8 @@ $eqmt = new Equipment;
|
||||||
|
|
||||||
$csrf_key = 'delete_entry_' . $entry_to_delete->id;
|
$csrf_key = 'delete_entry_' . $entry_to_delete->id;
|
||||||
|
|
||||||
if (f('delete') && $form->check($csrf_key) && !$form->hasErrors())
|
$form->runIf(f('delete') && !$form->hasErrors(),
|
||||||
|
function() use ($mvt, $eqmt, $entry_to_delete)
|
||||||
{
|
{
|
||||||
// delete the movement required
|
// delete the movement required
|
||||||
$mvt->delete($entry_to_delete->id);
|
$mvt->delete($entry_to_delete->id);
|
||||||
|
@ -33,8 +34,8 @@ if (f('delete') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
}
|
}
|
||||||
catch (\RuntimeException $e){
|
catch (\RuntimeException $e){
|
||||||
}
|
}
|
||||||
Utils::redirect(PLUGIN_URL . 'mouvements/entrees/index.php');
|
Utils::redirect(Utils::plugin_url() . 'mouvements/entrees/index.php');
|
||||||
}
|
});
|
||||||
|
|
||||||
$corresponding_eqmt = $eqmt->get($entry_to_delete->equipment_id);
|
$corresponding_eqmt = $eqmt->get($entry_to_delete->equipment_id);
|
||||||
|
|
||||||
|
@ -42,7 +43,7 @@ $corresponding_eqmt = $eqmt->get($entry_to_delete->equipment_id);
|
||||||
if ($mvt->PossibilityDeleteEntry($entry_to_delete))
|
if ($mvt->PossibilityDeleteEntry($entry_to_delete))
|
||||||
{
|
{
|
||||||
// it's possible
|
// it's possible
|
||||||
$cancel_link = PLUGIN_URL . 'mouvements/entrees/index.php';
|
$cancel_link = Utils::plugin_url() . 'mouvements/entrees/index.php';
|
||||||
// construct string to send to template
|
// construct string to send to template
|
||||||
$entry_string = (string) $entry_to_delete->equipment_number . " " . $corresponding_eqmt->designation . " à la date du " . date_create_from_format(
|
$entry_string = (string) $entry_to_delete->equipment_number . " " . $corresponding_eqmt->designation . " à la date du " . date_create_from_format(
|
||||||
"Y-m-d", $entry_to_delete->mvt_date)->format("d/m/y");
|
"Y-m-d", $entry_to_delete->mvt_date)->format("d/m/y");
|
||||||
|
|
|
@ -15,7 +15,8 @@ $selected_eqmt = "";
|
||||||
// check if add form is submitted
|
// check if add form is submitted
|
||||||
$csrf_key = 'add_output';
|
$csrf_key = 'add_output';
|
||||||
|
|
||||||
if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
$form->runIf (f('save') && !$form->hasErrors(),
|
||||||
|
function() use ($mvt, $eqmt, $selected_eqmt, $form)
|
||||||
{
|
{
|
||||||
$eqmt_id = f('equipment_id');
|
$eqmt_id = f('equipment_id');
|
||||||
$eqmt_number = (int) f('equipment_number');
|
$eqmt_number = (int) f('equipment_number');
|
||||||
|
@ -33,7 +34,7 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
'mvt_date' => $mvt_date_format,
|
'mvt_date' => $mvt_date_format,
|
||||||
'additional_comment' => f('additional_comment'),
|
'additional_comment' => f('additional_comment'),
|
||||||
]);
|
]);
|
||||||
Utils::redirect(PLUGIN_URL . 'mouvements/sorties/index.php');
|
Utils::redirect(Utils::plugin_url() . 'mouvements/sorties/index.php');
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// not possible, add error to form
|
// not possible, add error to form
|
||||||
|
@ -43,7 +44,7 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
// keep the datas submitted as selected
|
// keep the datas submitted as selected
|
||||||
$selected_eqmt = $eqmt_id;
|
$selected_eqmt = $eqmt_id;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// get list of borrowed equipments ordered by category
|
// get list of borrowed equipments ordered by category
|
||||||
$eqmts_by_cat = $eqmt->ListAllBorrowedByCategory();
|
$eqmts_by_cat = $eqmt->ListAllBorrowedByCategory();
|
||||||
|
@ -56,7 +57,7 @@ $comment_placeholder = "ex: matériel rendu...";
|
||||||
|
|
||||||
// make cancel link, legend for the title of the form
|
// make cancel link, legend for the title of the form
|
||||||
// and the template name for equipment to use in form
|
// and the template name for equipment to use in form
|
||||||
$cancel_link = PLUGIN_URL . 'mouvements/sorties/index.php';
|
$cancel_link = Utils::plugin_url() . 'mouvements/sorties/index.php';
|
||||||
$legend_part = "emprunté";
|
$legend_part = "emprunté";
|
||||||
$tpl_materiel_name = "emprunte";
|
$tpl_materiel_name = "emprunte";
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,8 @@ $selected_kind = $kinds[0];
|
||||||
// check if add form is submitted
|
// check if add form is submitted
|
||||||
$csrf_key = 'add_output';
|
$csrf_key = 'add_output';
|
||||||
|
|
||||||
if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
$form->runIf(f('save') && !$form->hasErrors(),
|
||||||
|
function() use ($mvt, $eqmt)
|
||||||
{
|
{
|
||||||
$eqmt_id = f('equipment_id');
|
$eqmt_id = f('equipment_id');
|
||||||
$eqmt_number = (int) f('equipment_number');
|
$eqmt_number = (int) f('equipment_number');
|
||||||
|
@ -40,7 +41,7 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
'mvt_date' => $mvt_date_format,
|
'mvt_date' => $mvt_date_format,
|
||||||
'additional_comment' => f('additional_comment'),
|
'additional_comment' => f('additional_comment'),
|
||||||
]);
|
]);
|
||||||
Utils::redirect(PLUGIN_URL . 'mouvements/sorties/index.php');
|
Utils::redirect(Utils::plugin_url() . 'mouvements/sorties/index.php');
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// not possible, add error to form
|
// not possible, add error to form
|
||||||
|
@ -51,7 +52,7 @@ if (f('save') && $form->check($csrf_key) && !$form->hasErrors())
|
||||||
$selected_eqmt = $eqmt_id;
|
$selected_eqmt = $eqmt_id;
|
||||||
$selected_kind = f('kind');
|
$selected_kind = f('kind');
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
// make default date (now)
|
// make default date (now)
|
||||||
$default_date = new \DateTime;
|
$default_date = new \DateTime;
|
||||||
|
@ -61,7 +62,7 @@ $comment_placeholder = "ex: don fait à...";
|
||||||
|
|
||||||
// make cancel link, legend for the title of the form
|
// make cancel link, legend for the title of the form
|
||||||
// and the template name for equipment to use in form
|
// and the template name for equipment to use in form
|
||||||
$cancel_link = PLUGIN_URL . 'mouvements/sorties/index.php';
|
$cancel_link = Utils::plugin_url() . 'mouvements/sorties/index.php';
|
||||||
$legend_part = "en stock disponible";
|
$legend_part = "en stock disponible";
|
||||||
$tpl_materiel_name = "stock_disponible";
|
$tpl_materiel_name = "stock_disponible";
|
||||||
|
|
||||||
|
|
|
@ -19,12 +19,13 @@ if (!$output_to_delete)
|
||||||
// check if delete form is submitted
|
// check if delete form is submitted
|
||||||
$csrf_key = 'delete_output_' . $output_to_delete->id;
|
$csrf_key = 'delete_output_' . $output_to_delete->id;
|
||||||
|
|
||||||
if (f('delete') && $form->check($csrf_key) && !$form->hasErrors())
|
$form->runIf (f('delete') && !$form->hasErrors(),
|
||||||
|
function () use ($mvt)
|
||||||
{
|
{
|
||||||
// delete the movement required
|
// delete the movement required
|
||||||
$mvt->delete($output_to_delete->id);
|
$mvt->delete($output_to_delete->id);
|
||||||
Utils::redirect(PLUGIN_URL . 'mouvements/sorties/index.php');
|
Utils::redirect(Utils::plugin_url() . 'mouvements/sorties/index.php');
|
||||||
}
|
});
|
||||||
|
|
||||||
$eqmt = new Equipment;
|
$eqmt = new Equipment;
|
||||||
$corresponding_eqmt = $eqmt->get($output_to_delete->equipment_id);
|
$corresponding_eqmt = $eqmt->get($output_to_delete->equipment_id);
|
||||||
|
@ -33,7 +34,7 @@ $corresponding_eqmt = $eqmt->get($output_to_delete->equipment_id);
|
||||||
if ($mvt->PossibilityDeleteOutput($output_to_delete))
|
if ($mvt->PossibilityDeleteOutput($output_to_delete))
|
||||||
{
|
{
|
||||||
// it's possible
|
// it's possible
|
||||||
$cancel_link = PLUGIN_URL . 'mouvements/sorties/index.php';
|
$cancel_link = Utils::plugin_url() . 'mouvements/sorties/index.php';
|
||||||
// construct string to send to template
|
// construct string to send to template
|
||||||
$output_string = (string) $output_to_delete->equipment_number . " " . $corresponding_eqmt->designation . " à la date du " . date_create_from_format(
|
$output_string = (string) $output_to_delete->equipment_number . " " . $corresponding_eqmt->designation . " à la date du " . date_create_from_format(
|
||||||
"Y-m-d", $output_to_delete->mvt_date)->format("d/m/y");
|
"Y-m-d", $output_to_delete->mvt_date)->format("d/m/y");
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<!-- title -->
|
<!-- title -->
|
||||||
{include file="admin/_head.tpl" title="%s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id}
|
{include file="_head.tpl" title="%s"|args:$plugin.nom current="plugin_%s"|args:$plugin.id}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- nav bar -->
|
<!-- nav bar -->
|
||||||
<nav class="tabs">
|
<nav class="tabs">
|
||||||
|
|
|
@ -37,5 +37,5 @@
|
||||||
</table>
|
</table>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -78,5 +78,5 @@
|
||||||
<!-- -->
|
<!-- -->
|
||||||
{linkbutton label="Retour" shape="export" href=$return_link}
|
{linkbutton label="Retour" shape="export" href=$return_link}
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -18,5 +18,5 @@
|
||||||
</form>
|
</form>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
}
|
}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -26,7 +26,14 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{foreach from=$mvts item="mvt"}
|
{foreach from=$mvts item="mvt"}
|
||||||
<tr>
|
<tr>
|
||||||
|
<?php
|
||||||
|
$mvt_date = date("d/m/Y", strtotime($mvt->mvt_date));
|
||||||
|
?>
|
||||||
|
{*
|
||||||
<td>{$mvt.mvt_date|date_format:'%d/%m/%y'}</td>
|
<td>{$mvt.mvt_date|date_format:'%d/%m/%y'}</td>
|
||||||
|
Erreur : dates décalées d'un jour (en arrière)
|
||||||
|
*}
|
||||||
|
<td>{$mvt_date}</td>
|
||||||
{if $mvt.side}
|
{if $mvt.side}
|
||||||
<td>Sortie</td>
|
<td>Sortie</td>
|
||||||
{else}
|
{else}
|
||||||
|
@ -43,5 +50,5 @@
|
||||||
<!-- -->
|
<!-- -->
|
||||||
{linkbutton label="Retour" shape="export" href=$return_link}
|
{linkbutton label="Retour" shape="export" href=$return_link}
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -115,5 +115,5 @@
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -26,5 +26,5 @@
|
||||||
</form>
|
</form>
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -5,5 +5,5 @@
|
||||||
{include file="%smouvements/formulaire_mouvement.tpl"|args:$plugin_tpl legend="entrée d'un matériel %s"|args:$legend_part tpl_materiel_name=$tpl_materiel_name kinds=$kinds selected_kind=$selected_kind default_date=$default_date label_date="Date d'entrée" tpl_materiel_path="entrees" comment_placeholder=$comment_placeholder csrf_key=$csrf_key cancel_link=$cancel_link}
|
{include file="%smouvements/formulaire_mouvement.tpl"|args:$plugin_tpl legend="entrée d'un matériel %s"|args:$legend_part tpl_materiel_name=$tpl_materiel_name kinds=$kinds selected_kind=$selected_kind default_date=$default_date label_date="Date d'entrée" tpl_materiel_path="entrees" comment_placeholder=$comment_placeholder csrf_key=$csrf_key cancel_link=$cancel_link}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -13,5 +13,5 @@
|
||||||
{include file="%smouvements/tableau_mouvements.tpl"|args:$plugin_tpl mvts=$mvts del_href="supprimer_entree.php?id=%d"}
|
{include file="%smouvements/tableau_mouvements.tpl"|args:$plugin_tpl mvts=$mvts del_href="supprimer_entree.php?id=%d"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
}
|
}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -5,5 +5,5 @@
|
||||||
{include file="%smouvements/formulaire_mouvement.tpl"|args:$plugin_tpl legend="sortie d'un matériel %s"|args:$legend_part tpl_materiel_name=$tpl_materiel_name kinds=$kinds selected_kind=$selected_kind default_date=$default_date label_date="Date de sortie" tpl_materiel_path="sorties" comment_placeholder=$comment_placeholder csrf_key=$csrf_key cancel_link=$cancel_link}
|
{include file="%smouvements/formulaire_mouvement.tpl"|args:$plugin_tpl legend="sortie d'un matériel %s"|args:$legend_part tpl_materiel_name=$tpl_materiel_name kinds=$kinds selected_kind=$selected_kind default_date=$default_date label_date="Date de sortie" tpl_materiel_path="sorties" comment_placeholder=$comment_placeholder csrf_key=$csrf_key cancel_link=$cancel_link}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -12,5 +12,5 @@
|
||||||
{include file="%smouvements/tableau_mouvements.tpl"|args:$plugin_tpl mvts=$mvts del_href="supprimer_sortie.php?id=%d"}
|
{include file="%smouvements/tableau_mouvements.tpl"|args:$plugin_tpl mvts=$mvts del_href="supprimer_sortie.php?id=%d"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -9,5 +9,5 @@
|
||||||
}
|
}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<!-- footer -->
|
<!-- footer -->
|
||||||
{include file="admin/_foot.tpl"}
|
{include file="_foot.tpl"}
|
||||||
<!-- -->
|
<!-- -->
|
||||||
|
|
|
@ -12,7 +12,14 @@
|
||||||
<tbody>
|
<tbody>
|
||||||
{foreach from=$mvts item="mvt"}
|
{foreach from=$mvts item="mvt"}
|
||||||
<tr>
|
<tr>
|
||||||
|
<?php
|
||||||
|
$mvt_date = date("d/m/Y", strtotime($mvt->mvt_date));
|
||||||
|
?>
|
||||||
|
{*
|
||||||
<td>{$mvt.mvt_date|date_format:'%d/%m/%y'}</td>
|
<td>{$mvt.mvt_date|date_format:'%d/%m/%y'}</td>
|
||||||
|
Erreur : dates décalées d'un jour (en arrière)
|
||||||
|
*}
|
||||||
|
<td>{$mvt_date}</td>
|
||||||
<td>{$mvt.kind}</td>
|
<td>{$mvt.kind}</td>
|
||||||
<td class="num">{$mvt.equipment_number}</td>
|
<td class="num">{$mvt.equipment_number}</td>
|
||||||
<td>{$mvt.equipment}</td>
|
<td>{$mvt.equipment}</td>
|
||||||
|
|
Loading…
Reference in New Issue