code cleaning
This commit is contained in:
parent
0c0c9269d5
commit
b87c3b80af
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -31,15 +31,15 @@ if ($_POST) {
|
||||
$value = GETPOST('PRODUIT_ATTRIBUTES_HIDECHILD');
|
||||
|
||||
if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_HIDECHILD', $value, 'chaine', 0, '', $conf->entity)) {
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
} else {
|
||||
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
||||
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
|
||||
}
|
||||
|
||||
if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) {
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
} else {
|
||||
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
||||
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
|
||||
}
|
||||
|
||||
}
|
||||
@ -62,9 +62,9 @@ print '<tr class="oddeven"><td>'.$langs->trans('HideProductCombinations').'</td>
|
||||
print $form->selectyesno("PRODUIT_ATTRIBUTES_HIDECHILD",$conf->global->PRODUIT_ATTRIBUTES_HIDECHILD,1).'</td></tr>';
|
||||
print '<tr class="oddeven"><td>'.$langs->trans('CombinationsSeparator').'</td>';
|
||||
if(isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
|
||||
$separator = $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR;
|
||||
$separator = $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR;
|
||||
} else {
|
||||
$separator = "_";
|
||||
$separator = "_";
|
||||
}
|
||||
print '<td align="right"><input size="3" type="text" class="flat" name="PRODUIT_ATTRIBUTES_SEPARATOR" value="'.$separator.'"></td></tr>';
|
||||
print '</table>';
|
||||
@ -72,6 +72,4 @@ print '<br><div style="text-align: center"><input type="submit" value="'.$langs-
|
||||
print '</form>';
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -50,9 +51,9 @@ if ($_POST) {
|
||||
$object->label = $label;
|
||||
|
||||
if ($object->update($user) < 1) {
|
||||
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
||||
setEventMessages($langs->trans('CoreErrorMessage'), $object->errors, 'errors');
|
||||
} else {
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
header('Location: '.dol_buildpath('/variants/card.php?id='.$id, 2));
|
||||
exit();
|
||||
}
|
||||
@ -77,9 +78,9 @@ if ($_POST) {
|
||||
if (! $error)
|
||||
{
|
||||
if ($objectval->update($user) > 0) {
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
} else {
|
||||
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
||||
setEventMessages($langs->trans('CoreErrorMessage'), $objectval->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -99,11 +100,11 @@ if ($confirm == 'yes') {
|
||||
|
||||
if ($res < 1 || ($object->delete() < 1)) {
|
||||
$db->rollback();
|
||||
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
||||
setEventMessages($langs->trans('CoreErrorMessage'), $object->errors, 'errors');
|
||||
header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2));
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
header('Location: '.dol_buildpath('/variants/list.php', 2));
|
||||
}
|
||||
exit();
|
||||
@ -113,9 +114,9 @@ if ($confirm == 'yes') {
|
||||
if ($objectval->fetch($valueid) > 0) {
|
||||
|
||||
if ($objectval->delete() < 1) {
|
||||
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
||||
setEventMessages($langs->trans('CoreErrorMessage'), $objectval->errors, 'errors');
|
||||
} else {
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
}
|
||||
|
||||
header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2));
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -104,7 +105,7 @@ if ($_POST) {
|
||||
$features = $_SESSION['addvariant_'.$object->id];
|
||||
|
||||
if (!$features) {
|
||||
setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -147,7 +148,7 @@ if ($_POST) {
|
||||
$result = $prodcomb->createProductCombination($object, $sanit_features, array(), $price_impact_percent, $price_impact, $weight_impact);
|
||||
if ($result > 0)
|
||||
{
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
unset($_SESSION['addvariant_'.$object->id]);
|
||||
|
||||
$db->commit();
|
||||
@ -214,7 +215,7 @@ if ($_POST) {
|
||||
|
||||
} else {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -230,7 +231,7 @@ if ($_POST) {
|
||||
$prodcomb->variation_weight = $weight_impact;
|
||||
|
||||
if ($prodcomb->update($user) > 0) {
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
|
||||
exit();
|
||||
} else {
|
||||
@ -250,13 +251,13 @@ if ($action === 'confirm_deletecombination') {
|
||||
|
||||
if ($prodcomb->delete($user) > 0 && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete($user) > 0) {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$object->id, 2));
|
||||
exit();
|
||||
}
|
||||
|
||||
$db->rollback();
|
||||
setEventMessage($langs->trans('ProductCombinationAlreadyUsed'), 'errors');
|
||||
setEventMessages($langs->trans('ProductCombinationAlreadyUsed'), null, 'errors');
|
||||
$action = '';
|
||||
}
|
||||
} elseif ($action === 'edit') {
|
||||
@ -284,12 +285,12 @@ if ($action === 'confirm_deletecombination') {
|
||||
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$prodstatic->id, 2));
|
||||
exit();
|
||||
} else {
|
||||
setEventMessage($langs->trans('ErrorCopyProductCombinations'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorCopyProductCombinations'), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
setEventMessage($langs->trans('ErrorDestinationProductNotFound'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorDestinationProductNotFound'), null, 'errors');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -29,7 +30,7 @@ $backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
if ($_POST) {
|
||||
if (empty($ref) || empty($label)) {
|
||||
setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
|
||||
} else {
|
||||
|
||||
$prodattr = new ProductAttribute($db);
|
||||
@ -38,7 +39,7 @@ if ($_POST) {
|
||||
|
||||
$resid = $prodattr->create($user);
|
||||
if ($resid > 0) {
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
if ($backtopage)
|
||||
{
|
||||
header('Location: '.$backtopage);
|
||||
@ -49,7 +50,7 @@ if ($_POST) {
|
||||
}
|
||||
exit;
|
||||
} else {
|
||||
setEventMessage($langs->trans('ErrorRecordAlreadyExists'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorRecordAlreadyExists'), $prodattr->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -58,7 +59,7 @@ if ($cancel)
|
||||
if ($action == 'add')
|
||||
{
|
||||
if (empty($ref) || empty($value)) {
|
||||
setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
|
||||
} else {
|
||||
|
||||
$objectval->fk_product_attribute = $object->id;
|
||||
@ -66,11 +67,11 @@ if ($action == 'add')
|
||||
$objectval->value = $value;
|
||||
|
||||
if ($objectval->create($user) > 0) {
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
header('Location: '.DOL_URL_ROOT.'/variants/card.php?id='.$object->id);
|
||||
exit();
|
||||
} else {
|
||||
setEventMessage($langs->trans('ErrorCreatingProductAttributeValue'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorCreatingProductAttributeValue'), $objectval->errors, 'errors');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
/* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -115,18 +115,18 @@ if ($_POST) {
|
||||
|
||||
if ($res > 0) {
|
||||
$db->commit();
|
||||
setEventMessage($langs->trans('RecordSaved'));
|
||||
setEventMessages($langs->trans('RecordSaved'), null);
|
||||
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
setEventMessage($langs->trans('ErrorDeletingGeneratedProducts'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorDeletingGeneratedProducts'), null, 'errors');
|
||||
}
|
||||
|
||||
$db->rollback();
|
||||
|
||||
} else {
|
||||
setEventMessage($langs->trans('ErrorFieldsRequired'), 'errors');
|
||||
setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user