Debug module variant
This commit is contained in:
parent
e1a6e6e4ab
commit
d5b10a18b7
@ -93,7 +93,7 @@ if ($action == 'builddoc' && $permissioncreate)
|
|||||||
setEventMessages($langs->trans("FileGenerated"), null);
|
setEventMessages($langs->trans("FileGenerated"), null);
|
||||||
|
|
||||||
header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc');
|
header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc');
|
||||||
die;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,9 +35,9 @@
|
|||||||
class FormFile
|
class FormFile
|
||||||
{
|
{
|
||||||
private $db;
|
private $db;
|
||||||
private $numoffiles;
|
|
||||||
|
|
||||||
public $error;
|
public $error;
|
||||||
|
public $numoffiles;
|
||||||
public $infofiles; // Used to return informations by function getDocumentsLink
|
public $infofiles; // Used to return informations by function getDocumentsLink
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -248,7 +248,7 @@ if (empty($object->ref)) // For survey, id is a hex string
|
|||||||
llxFooterSurvey();
|
llxFooterSurvey();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
exit;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define format of choices
|
// Define format of choices
|
||||||
@ -287,7 +287,7 @@ if (!$canbemodified) {
|
|||||||
llxFooterSurvey();
|
llxFooterSurvey();
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
die;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form name="formulaire" action="studs.php?sondage='.$numsondage.'"'.'#bas" method="POST">'."\n";
|
print '<form name="formulaire" action="studs.php?sondage='.$numsondage.'"'.'#bas" method="POST">'."\n";
|
||||||
|
|||||||
@ -34,7 +34,7 @@ if (!$id) {
|
|||||||
print json_encode(array(
|
print json_encode(array(
|
||||||
'error' => 'ID not set'
|
'error' => 'ID not set'
|
||||||
));
|
));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$product = new Product($db);
|
$product = new Product($db);
|
||||||
|
|||||||
@ -35,7 +35,7 @@ if (!$id) {
|
|||||||
print json_encode(array(
|
print json_encode(array(
|
||||||
'error' => 'ID not set'
|
'error' => 'ID not set'
|
||||||
));
|
));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$prodattr = new ProductAttribute($db);
|
$prodattr = new ProductAttribute($db);
|
||||||
@ -44,7 +44,7 @@ if ($prodattr->fetch($id) < 0) {
|
|||||||
print json_encode(array(
|
print json_encode(array(
|
||||||
'error' => 'Attribute not found'
|
'error' => 'Attribute not found'
|
||||||
));
|
));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$prodattrval = new ProductAttributeValue($db);
|
$prodattrval = new ProductAttributeValue($db);
|
||||||
@ -55,7 +55,7 @@ if ($res == -1) {
|
|||||||
print json_encode(array(
|
print json_encode(array(
|
||||||
'error' => 'Internal error'
|
'error' => 'Internal error'
|
||||||
));
|
));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
print json_encode($res);
|
print json_encode($res);
|
||||||
@ -33,7 +33,7 @@ $prodattrval = new ProductAttributeValue($db);
|
|||||||
|
|
||||||
if ($prodattr->fetch($id) < 1) {
|
if ($prodattr->fetch($id) < 1) {
|
||||||
dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
|
dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -54,7 +54,7 @@ if ($_POST) {
|
|||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('RecordSaved'));
|
setEventMessage($langs->trans('RecordSaved'));
|
||||||
header('Location: '.dol_buildpath('/variants/card.php?id='.$id, 2));
|
header('Location: '.dol_buildpath('/variants/card.php?id='.$id, 2));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
} elseif ($action == 'edit_value') {
|
} elseif ($action == 'edit_value') {
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ if ($_POST) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2));
|
header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ if ($confirm == 'yes') {
|
|||||||
header('Location: '.dol_buildpath('/variants/list.php', 2));
|
header('Location: '.dol_buildpath('/variants/list.php', 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
die;
|
exit();
|
||||||
} elseif ($action == 'confirm_deletevalue') {
|
} elseif ($action == 'confirm_deletevalue') {
|
||||||
|
|
||||||
if ($prodattrval->fetch($valueid) > 0) {
|
if ($prodattrval->fetch($valueid) > 0) {
|
||||||
@ -105,7 +105,7 @@ if ($confirm == 'yes') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2));
|
header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,15 +46,22 @@ $prodstatic = new Product($db);
|
|||||||
$prodattr = new ProductAttribute($db);
|
$prodattr = new ProductAttribute($db);
|
||||||
$prodattr_val = new ProductAttributeValue($db);
|
$prodattr_val = new ProductAttributeValue($db);
|
||||||
|
|
||||||
$product = new Product($db);
|
$object = new Product($db);
|
||||||
|
if ($id > 0 || $ref)
|
||||||
$product->fetch($id);
|
{
|
||||||
|
$object->fetch($id, $ref);
|
||||||
if (!$product->isProduct()) {
|
|
||||||
header('Location: '.dol_buildpath('/product/card.php?id='.$product->id, 2));
|
|
||||||
die;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (! $object->isProduct()) {
|
||||||
|
header('Location: '.dol_buildpath('/product/card.php?id='.$object->id, 2));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$prodcomb = new ProductCombination($db);
|
$prodcomb = new ProductCombination($db);
|
||||||
$prodcomb2val = new ProductCombination2ValuePair($db);
|
$prodcomb2val = new ProductCombination2ValuePair($db);
|
||||||
|
|
||||||
@ -103,7 +110,7 @@ if ($_POST) {
|
|||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessage($langs->trans('RecordSaved'));
|
setEventMessage($langs->trans('RecordSaved'));
|
||||||
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
|
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
|
||||||
die;
|
exit();
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
||||||
}
|
}
|
||||||
@ -171,7 +178,7 @@ if ($_POST) {
|
|||||||
|
|
||||||
if ($prodcomb->fetch($valueid) < 0) {
|
if ($prodcomb->fetch($valueid) < 0) {
|
||||||
dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
|
dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$prodcomb->variation_price_percentage = $price_impact_percent;
|
$prodcomb->variation_price_percentage = $price_impact_percent;
|
||||||
@ -181,14 +188,14 @@ if ($_POST) {
|
|||||||
if ($prodcomb->update() > 0) {
|
if ($prodcomb->update() > 0) {
|
||||||
setEventMessage($langs->trans('RecordSaved'));
|
setEventMessage($langs->trans('RecordSaved'));
|
||||||
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
|
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$id, 2));
|
||||||
die;
|
exit();
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$productCombinations = $prodcomb->fetchAllByFkProductParent($id);
|
$productCombinations = $prodcomb->fetchAllByFkProductParent($object->id);
|
||||||
|
|
||||||
if ($action === 'confirm_deletecombination') {
|
if ($action === 'confirm_deletecombination') {
|
||||||
|
|
||||||
@ -199,8 +206,8 @@ if ($action === 'confirm_deletecombination') {
|
|||||||
if ($prodcomb->delete() > 0 && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete() > 0) {
|
if ($prodcomb->delete() > 0 && $prodstatic->fetch($prodcomb->fk_product_child) > 0 && $prodstatic->delete() > 0) {
|
||||||
$db->commit();
|
$db->commit();
|
||||||
setEventMessage($langs->trans('RecordSaved'));
|
setEventMessage($langs->trans('RecordSaved'));
|
||||||
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$product->id, 2));
|
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$object->id, 2));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
@ -211,7 +218,7 @@ if ($action === 'confirm_deletecombination') {
|
|||||||
|
|
||||||
if ($prodcomb->fetch($valueid) < 0) {
|
if ($prodcomb->fetch($valueid) < 0) {
|
||||||
dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
|
dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$weight_impact = $prodcomb->variation_weight;
|
$weight_impact = $prodcomb->variation_weight;
|
||||||
@ -227,10 +234,10 @@ if ($action === 'confirm_deletecombination') {
|
|||||||
if ($prodstatic->fetch('', $dest_product) > 0) {
|
if ($prodstatic->fetch('', $dest_product) > 0) {
|
||||||
|
|
||||||
//To prevent from copying to the same product
|
//To prevent from copying to the same product
|
||||||
if ($prodstatic->ref != $product->ref) {
|
if ($prodstatic->ref != $object->ref) {
|
||||||
if ($prodcomb->copyAll($product->id, $prodstatic) > 0) {
|
if ($prodcomb->copyAll($object->id, $prodstatic) > 0) {
|
||||||
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$prodstatic->id, 2));
|
header('Location: '.dol_buildpath('/variants/combinations.php?id='.$prodstatic->id, 2));
|
||||||
die;
|
exit();
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('ErrorCopyProductCombinations'), 'errors');
|
setEventMessage($langs->trans('ErrorCopyProductCombinations'), 'errors');
|
||||||
}
|
}
|
||||||
@ -242,47 +249,31 @@ if ($action === 'confirm_deletecombination') {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* View
|
* View
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (! empty($id) || ! empty($ref)) {
|
if (! empty($id) || ! empty($ref)) {
|
||||||
$object = new Product($db);
|
|
||||||
$result = $object->fetch($id, $ref);
|
|
||||||
|
|
||||||
llxHeader("", "", $langs->trans("CardProduct".$object->type));
|
llxHeader("", "", $langs->trans("CardProduct".$object->type));
|
||||||
|
|
||||||
if ($result) {
|
if ($result)
|
||||||
$head = product_prepare_head($object);
|
{
|
||||||
$titre = $langs->trans("CardProduct".$object->type);
|
$showbarcode=empty($conf->barcode->enabled)?0:1;
|
||||||
$picto = ($object->type == Product::TYPE_SERVICE ? 'service' : 'product');
|
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
|
||||||
|
|
||||||
dol_fiche_head($head, 'combinations', $titre, 0, $picto);
|
$head=product_prepare_head($object);
|
||||||
|
$titre=$langs->trans("CardProduct".$object->type);
|
||||||
print '<table class="border" width="100%">';
|
$picto=($object->type== Product::TYPE_SERVICE?'service':'product');
|
||||||
|
dol_fiche_head($head, 'combinations', $titre, 0, $picto);
|
||||||
// Reference
|
|
||||||
print '<tr>';
|
$linkback = '<a href="'.DOL_URL_ROOT.'/product/list.php?type='.$object->type.'">'.$langs->trans("BackToList").'</a>';
|
||||||
print '<td width="30%">'.$langs->trans("Ref").'</td><td colspan="3">';
|
$object->next_prev_filter=" fk_product_type = ".$object->type;
|
||||||
print $form->showrefnav($object, 'id', '', 0);
|
|
||||||
print '</td>';
|
dol_banner_tab($object, 'ref', $linkback, ($user->societe_id?0:1), 'ref', '', '', '', 0, '', '', 1);
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Label
|
|
||||||
print '<tr><td>'.$langs->trans("Label").'</td><td colspan="3">'.$object->label.'</td></tr>';
|
|
||||||
|
|
||||||
// Status (to sell)
|
|
||||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Sell").')</td><td>';
|
|
||||||
print $object->getLibStatut(2, 0);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Status (to buy)
|
|
||||||
print '<tr><td>'.$langs->trans("Status").' ('.$langs->trans("Buy").')</td><td>';
|
|
||||||
print $object->getLibStatut(2, 1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,7 +526,9 @@ if (! empty($id) || ! empty($ref)) {
|
|||||||
|
|
||||||
$comb2val = new ProductCombination2ValuePair($db);
|
$comb2val = new ProductCombination2ValuePair($db);
|
||||||
|
|
||||||
if ($productCombinations): ?>
|
if ($productCombinations)
|
||||||
|
{
|
||||||
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
@ -571,7 +564,7 @@ if (! empty($id) || ! empty($ref)) {
|
|||||||
<input type="submit" value="<?php echo $langs->trans("Apply") ?>" class="button">
|
<input type="submit" value="<?php echo $langs->trans("Apply") ?>" class="button">
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<?php endif; ?>
|
<?php } ?>
|
||||||
|
|
||||||
<table class="liste">
|
<table class="liste">
|
||||||
<tr class="liste_titre">
|
<tr class="liste_titre">
|
||||||
|
|||||||
@ -29,7 +29,7 @@ $prodattrval = new ProductAttributeValue($db);
|
|||||||
|
|
||||||
if ($prodattr->fetch($id) < 1) {
|
if ($prodattr->fetch($id) < 1) {
|
||||||
dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
|
dol_print_error($db, $langs->trans('ErrorRecordNotFound'));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_POST) {
|
if ($_POST) {
|
||||||
@ -45,7 +45,7 @@ if ($_POST) {
|
|||||||
if ($prodattrval->create() > 0) {
|
if ($prodattrval->create() > 0) {
|
||||||
setEventMessage($langs->trans('RecordSaved'));
|
setEventMessage($langs->trans('RecordSaved'));
|
||||||
header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2));
|
header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2));
|
||||||
die;
|
exit();
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans('ErrorCreatingProductAttributeValue'), 'errors');
|
setEventMessage($langs->trans('ErrorCreatingProductAttributeValue'), 'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,7 +44,7 @@ $product->fetch($id);
|
|||||||
|
|
||||||
if (!$product->isProduct()) {
|
if (!$product->isProduct()) {
|
||||||
header('Location: '.dol_buildpath('/product/card.php?id='.$product->id, 2));
|
header('Location: '.dol_buildpath('/product/card.php?id='.$product->id, 2));
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -33,13 +33,13 @@ if ($action == 'up') {
|
|||||||
$object->moveUp();
|
$object->moveUp();
|
||||||
|
|
||||||
header('Location: '.$_SERVER['PHP_SELF']);
|
header('Location: '.$_SERVER['PHP_SELF']);
|
||||||
die;
|
exit();
|
||||||
} elseif ($action == 'down') {
|
} elseif ($action == 'down') {
|
||||||
$object->fetch($rowid);
|
$object->fetch($rowid);
|
||||||
$object->moveDown();
|
$object->moveDown();
|
||||||
|
|
||||||
header('Location: '.$_SERVER['PHP_SELF']);
|
header('Location: '.$_SERVER['PHP_SELF']);
|
||||||
die;
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user