2
0
forked from Wavyzz/dolibarr

clean indent in variants directory

This commit is contained in:
Frédéric FRANCE
2019-10-26 20:53:39 +02:00
parent 635306c084
commit a7797ba1da
16 changed files with 286 additions and 310 deletions

View File

@@ -186,7 +186,7 @@
<!-- Check indent are done with spaces and with correct number --> <!-- Check indent are done with spaces and with correct number -->
<!-- Disabled as this does not support tab --> <!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> --> <!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<!-- TODO Enable this
<arg name="tab-width" value="4"/> <arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.ScopeIndent"> <rule ref="Generic.WhiteSpace.ScopeIndent">
<properties> <properties>
@@ -194,7 +194,7 @@
<property name="tabIndent" value="true"/> <property name="tabIndent" value="true"/>
</properties> </properties>
</rule> </rule>
-->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" /> <rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />

View File

@@ -35,11 +35,11 @@ if ($_POST) {
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
} }
if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) { if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) {
setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); setEventMessages($langs->trans('RecordSaved'), null, 'mesgs');
} else { } else {
setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors'); setEventMessages($langs->trans('CoreErrorMessage'), null, 'errors');
} }
} }
$title = $langs->trans('ModuleSetup').' '.$langs->trans('ProductAttributes'); $title = $langs->trans('ModuleSetup').' '.$langs->trans('ProductAttributes');

View File

@@ -31,18 +31,18 @@ header('Content-Type: application/json');
$id = GETPOST('id', 'int'); $id = GETPOST('id', 'int');
if (!$id) { if (!$id) {
print json_encode(array( print json_encode(array(
'error' => 'ID not set' 'error' => 'ID not set'
)); ));
exit(); exit();
} }
$product = new Product($db); $product = new Product($db);
if ($product->fetch($id) < 0) { if ($product->fetch($id) < 0) {
print json_encode(array( print json_encode(array(
'error' => 'Product not found' 'error' => 'Product not found'
)); ));
} }
$prodcomb = new ProductCombination($db); $prodcomb = new ProductCombination($db);

View File

@@ -31,19 +31,19 @@ header('Content-Type: application/json');
$id = GETPOST('id'); $id = GETPOST('id');
if (!$id) { if (!$id) {
print json_encode(array( print json_encode(array(
'error' => 'ID not set' 'error' => 'ID not set'
)); ));
exit(); exit();
} }
$prodattr = new ProductAttribute($db); $prodattr = new ProductAttribute($db);
if ($prodattr->fetch($id) < 0) { if ($prodattr->fetch($id) < 0) {
print json_encode(array( print json_encode(array(
'error' => 'Attribute not found' 'error' => 'Attribute not found'
)); ));
exit(); exit();
} }
$prodattrval = new ProductAttributeValue($db); $prodattrval = new ProductAttributeValue($db);
@@ -51,10 +51,10 @@ $prodattrval = new ProductAttributeValue($db);
$res = $prodattrval->fetchAllByProductAttribute($id); $res = $prodattrval->fetchAllByProductAttribute($id);
if ($res == -1) { if ($res == -1) {
print json_encode(array( print json_encode(array(
'error' => 'Internal error' 'error' => 'Internal error'
)); ));
exit(); exit();
} }
print json_encode($res); print json_encode($res);

View File

@@ -144,58 +144,54 @@ if ($action == 'edit') {
} }
if ($action != 'edit') if ($action != 'edit') {
{
print '<div class="fichecenter">'; print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
} }
?> print '<table class="border" style="width: 100%">';
<table class="border" style="width: 100%"> print '<tr>';
<tr> print '<td class="titlefield fieldrequired">'.$langs->trans('Ref').'</td>';
<td class="titlefield fieldrequired"><?php echo $langs->trans('Ref') ?></td> print '<td>';
<td> if ($action == 'edit') {
<?php if ($action == 'edit') { print '<input type="text" name="ref" value="'.$object->ref.'">';
print '<input type="text" name="ref" value="'.$object->ref.'">'; } else {
} else { print dol_htmlentities($object->ref);
print dol_htmlentities($object->ref); }
} ?> print '</td>';
</td> print '</tr>';
</tr> print '<tr>';
<tr> print '<td class="fieldrequired">'.$langs->trans('Label').'</td>';
<td class="fieldrequired"><?php echo $langs->trans('Label') ?></td> print '<td>';
<td> if ($action == 'edit') {
<?php if ($action == 'edit') { print '<input type="text" name="label" value="'.$object->label.'">';
print '<input type="text" name="label" value="'.$object->label.'">'; } else {
} else { print dol_htmlentities($object->label);
print dol_htmlentities($object->label); }
} ?> print '</td>';
</td> print '</tr>';
</tr>
</table> print '</table>';
<?php
if ($action != 'edit') if ($action != 'edit') {
{
print '</div>'; print '</div>';
} }
dol_fiche_end(); dol_fiche_end();
if ($action == 'edit') { ?> if ($action == 'edit') {
<div style="text-align: center;"> print '<div style="text-align: center;">';
<div class="inline-block divButAction"> print '<div class="inline-block divButAction">';
<input type="submit" class="button" value="<?php echo $langs->trans('Save') ?>"> print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
&nbsp; &nbsp; print '&nbsp; &nbsp;';
<input type="submit" class="button" name="cancel" value="<?php echo $langs->trans('Cancel') ?>"> print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
</div> print '</div>';
</div></form> print '</div></form>';
<?php } else { } else {
if ($action == 'delete') { if ($action == 'delete') {
$form = new Form($db); $form = new Form($db);
print $form->formconfirm( print $form->formconfirm(
"card.php?id=".$object->id, "card.php?id=".$object->id,
$langs->trans('Delete'), $langs->trans('Delete'),
$langs->trans('ProductAttributeDeleteDialog'), $langs->trans('ProductAttributeDeleteDialog'),
@@ -208,7 +204,7 @@ print $form->formconfirm(
if ($objectval->fetch($valueid) > 0) { if ($objectval->fetch($valueid) > 0) {
$form = new Form($db); $form = new Form($db);
print $form->formconfirm( print $form->formconfirm(
"card.php?id=".$object->id."&valueid=".$objectval->id, "card.php?id=".$object->id."&valueid=".$objectval->id,
$langs->trans('Delete'), $langs->trans('Delete'),
$langs->trans('ProductAttributeValueDeleteDialog', dol_htmlentities($objectval->value), dol_htmlentities($objectval->ref)), $langs->trans('ProductAttributeValueDeleteDialog', dol_htmlentities($objectval->value), dol_htmlentities($objectval->ref)),
@@ -241,20 +237,19 @@ print $form->formconfirm(
print '<input type="hidden" name="id" value="'.$id.'">'; print '<input type="hidden" name="id" value="'.$id.'">';
print '<input type="hidden" name="valueid" value="'.$valueid.'">'; print '<input type="hidden" name="valueid" value="'.$valueid.'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">'; print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
} ?> }
<table class="liste"> print '<table class="liste">';
<tr class="liste_titre"> print '<tr class="liste_titre">';
<th class="liste_titre titlefield"><?php echo $langs->trans('Ref') ?></th> print '<th class="liste_titre titlefield">'.$langs->trans('Ref').'</th>';
<th class="liste_titre"><?php echo $langs->trans('Value') ?></th> print '<th class="liste_titre">'.$langs->trans('Value').'</th>';
<th class="liste_titre"></th> print '<th class="liste_titre"></th>';
</tr> print '</tr>';
<?php foreach ($objectval->fetchAllByProductAttribute($object->id) as $attrval) {
foreach ($objectval->fetchAllByProductAttribute($object->id) as $attrval) { print '<tr class="oddeven">';
?> if ($action == 'edit_value' && ($valueid == $attrval->id)) {
<tr class="oddeven"> ?>
<?php if ($action == 'edit_value' && ($valueid == $attrval->id)): ?>
<td><input type="text" name="ref" value="<?php echo $attrval->ref ?>"></td> <td><input type="text" name="ref" value="<?php echo $attrval->ref ?>"></td>
<td><input type="text" name="value" value="<?php echo $attrval->value ?>"></td> <td><input type="text" name="value" value="<?php echo $attrval->value ?>"></td>
<td class="right"> <td class="right">
@@ -262,31 +257,30 @@ print $form->formconfirm(
&nbsp; &nbsp; &nbsp; &nbsp;
<input type="submit" name="cancel" value="<?php echo $langs->trans('Cancel') ?>" class="button"> <input type="submit" name="cancel" value="<?php echo $langs->trans('Cancel') ?>" class="button">
</td> </td>
<?php else: ?> <?php
} else {
?>
<td><?php echo dol_htmlentities($attrval->ref) ?></td> <td><?php echo dol_htmlentities($attrval->ref) ?></td>
<td><?php echo dol_htmlentities($attrval->value) ?></td> <td><?php echo dol_htmlentities($attrval->value) ?></td>
<td class="right"> <td class="right">
<a href="card.php?id=<?php echo $object->id ?>&action=edit_value&valueid=<?php echo $attrval->id ?>"><?php echo img_edit() ?></a> <a href="card.php?id=<?php echo $object->id ?>&action=edit_value&valueid=<?php echo $attrval->id ?>"><?php echo img_edit() ?></a>
<a href="card.php?id=<?php echo $object->id ?>&action=delete_value&valueid=<?php echo $attrval->id ?>"><?php echo img_delete() ?></a> <a href="card.php?id=<?php echo $object->id ?>&action=delete_value&valueid=<?php echo $attrval->id ?>"><?php echo img_delete() ?></a>
</td> </td>
<?php endif; ?> <?php
</tr>
<?php
} }
?> print '</tr>';
</table> }
print '</table>';
<?php if ($action == 'edit_value'): ?> if ($action == 'edit_value') {
</form> print '</form>';
<?php endif ?> }
<div class="tabsAction"> print '<div class="tabsAction">';
<div class="inline-block divButAction"> print '<div class="inline-block divButAction">';
<a href="create_val.php?id=<?php echo $object->id ?>" class="butAction"><?php echo $langs->trans('Create') ?></a> print '<a href="create_val.php?id='.$object->id.'" class="butAction">'.$langs->trans('Create').'</a>';
</div> print '</div>';
</div> print '</div>';
<?php
} }
// End of page // End of page

View File

@@ -572,9 +572,9 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
} }
if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) { if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
$newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref; $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref;
} else { } else {
$newproduct->ref .= '_'.$prodattrval->ref; $newproduct->ref .= '_'.$prodattrval->ref;
} }
//The first one should not contain a linebreak //The first one should not contain a linebreak

View File

@@ -425,7 +425,7 @@ if (! empty($id) || ! empty($ref))
<?php <?php
foreach ($productCombination2ValuePairs1 as $pc2v) { foreach ($productCombination2ValuePairs1 as $pc2v) {
$prodattr_val->fetch($pc2v->fk_prod_attr_val); $prodattr_val->fetch($pc2v->fk_prod_attr_val);
?> ?>
variants_selected.index.push(<?php echo $pc2v->fk_prod_attr ?>); variants_selected.index.push(<?php echo $pc2v->fk_prod_attr ?>);
variants_selected.info[<?php echo $pc2v->fk_prod_attr ?>] = { variants_selected.info[<?php echo $pc2v->fk_prod_attr ?>] = {
attribute: variants_available[<?php echo $pc2v->fk_prod_attr ?>], attribute: variants_available[<?php echo $pc2v->fk_prod_attr ?>],
@@ -434,7 +434,7 @@ if (! empty($id) || ! empty($ref))
label: '<?php echo $prodattr_val->value ?>' label: '<?php echo $prodattr_val->value ?>'
} }
}; };
<?php <?php
} }
?> ?>
@@ -484,7 +484,7 @@ if (! empty($id) || ! empty($ref))
}); });
</script> </script>
<?php <?php
} }
print '<br>'; print '<br>';
@@ -495,40 +495,36 @@ if (! empty($id) || ! empty($ref))
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="id" value="'.dol_escape_htmltag($id).'">'."\n"; print '<input type="hidden" name="id" value="'.dol_escape_htmltag($id).'">'."\n";
print '<input type="hidden" name="action" value="' . (($valueid > 0) ? "update" : "create") .'">'."\n"; print '<input type="hidden" name="action" value="' . (($valueid > 0) ? "update" : "create") .'">'."\n";
if($valueid > 0) { if ($valueid > 0) {
print '<input type="hidden" name="valueid" value="' . $valueid .'">'."\n"; print '<input type="hidden" name="valueid" value="' . $valueid .'">'."\n";
} }
print dol_fiche_head(); print dol_fiche_head();
?>
<table class="border" style="width: 100%"> print '<table class="border" style="width: 100%">';
<?php if ($action == 'add') { ?> if ($action == 'add') {
<!-- Variant --> print "<!-- Variant -->\n";
<tr> print '<tr>';
<td class="titlefieldcreate fieldrequired"><label for="attribute"><?php echo $langs->trans('ProductAttribute') ?></label></td> print '<td class="titlefieldcreate fieldrequired"><label for="attribute">'.$langs->trans('ProductAttribute').'</label></td>';
<td> print '<td>';
<?php if (is_array($prodattr_all)) {
if (is_array($prodattr_all)) print '<select class="flat minwidth100" id="attribute" name="attribute">';
{ print '<option value="-1">&nbsp;</option>';
print '<select class="flat minwidth100" id="attribute" name="attribute">'; foreach ($prodattr_all as $attr) {
print '<option value="-1">&nbsp;</option>'; //print '<option value="'.$attr->id.'"'.($attr->id == GETPOST('attribute', 'int') ? ' selected="selected"' : '').'>'.$attr->label.'</option>';
foreach ($prodattr_all as $attr) print '<option value="'.$attr->id.'">'.$attr->label.'</option>';
{
//print '<option value="'.$attr->id.'"'.($attr->id == GETPOST('attribute', 'int') ? ' selected="selected"' : '').'>'.$attr->label.'</option>';
print '<option value="'.$attr->id.'">'.$attr->label.'</option>';
}
print '</select>';
} }
print '</select>';
}
$htmltext=$langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes")); $htmltext=$langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes"));
print $form->textwithpicto('', $htmltext); print $form->textwithpicto('', $htmltext);
/*print ' &nbsp; &nbsp; <a href="'.DOL_URL_ROOT.'/variants/create.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=add&id='.$object->id).'">'; /*print ' &nbsp; &nbsp; <a href="'.DOL_URL_ROOT.'/variants/create.php?action=create&backtopage='.urlencode($_SERVER["PHP_SELF"].'?action=add&id='.$object->id).'">';
print $langs->trans("Create"); print $langs->trans("Create");
print '</a>';*/ print '</a>';*/
?> ?>
</td> </td>
</tr> </tr>
<!-- Value --> <!-- Value -->
@@ -555,15 +551,14 @@ if (! empty($id) || ! empty($ref))
</td> </td>
</tr> </tr>
<tr><td></td><td> <tr><td></td><td>
<?php echo $listofvariantselected; ?> <?php echo $listofvariantselected;
</td> print '</td>';
</tr> print '</tr>';
</table> print '</table>';
<?php }
}
if (is_array($productCombination2ValuePairs1)) { if (is_array($productCombination2ValuePairs1)) {
?> ?>
<hr> <hr>
<table class="border" style="width: 100%"> <table class="border" style="width: 100%">
<tr> <tr>
@@ -597,7 +592,7 @@ if (! empty($id) || ! empty($ref))
<td><input type="text" id="price_impact" name="price_impact" value="<?php echo price($price_impact) ?>"> <td><input type="text" id="price_impact" name="price_impact" value="<?php echo price($price_impact) ?>">
<input type="checkbox" id="price_impact_percent" name="price_impact_percent" <?php echo $price_impact_percent ? ' checked' : '' ?>> <label for="price_impact_percent"><?php echo $langs->trans('PercentageVariation') ?></label></td> <input type="checkbox" id="price_impact_percent" name="price_impact_percent" <?php echo $price_impact_percent ? ' checked' : '' ?>> <label for="price_impact_percent"><?php echo $langs->trans('PercentageVariation') ?></label></td>
</tr> </tr>
<?php <?php
if ($object->isProduct()) { if ($object->isProduct()) {
print '<tr>'; print '<tr>';
print '<td><label for="weight_impact">'.$langs->trans('WeightImpact').'</label></td>'; print '<td><label for="weight_impact">'.$langs->trans('WeightImpact').'</label></td>';
@@ -644,7 +639,7 @@ if (! empty($id) || ! empty($ref))
if ($productCombinations) if ($productCombinations)
{ {
?> ?>
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function() { jQuery(document).ready(function() {
@@ -751,62 +746,54 @@ if (! empty($id) || ! empty($ref))
print '</td>'; print '</td>';
?> ?>
</tr> </tr>
<?php
if (count($productCombinations))
{
foreach ($productCombinations as $currcomb)
{
$prodstatic->fetch($currcomb->fk_product_child);
?>
<tr class="oddeven">
<td><?php echo $prodstatic->getNomUrl(1) ?></td>
<td>
<?php
$productCombination2ValuePairs = $comb2val->fetchByFkCombination($currcomb->id);
$iMax = count($productCombination2ValuePairs);
for ($i = 0; $i < $iMax; $i++) {
echo dol_htmlentities($productCombination2ValuePairs[$i]);
if ($i !== ($iMax - 1)) {
echo ', ';
}
} ?>
</td>
<td class="right"><?php echo ($currcomb->variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?></td>
<?php if ($object->isProduct()) print '<td class="right">'.($currcomb->variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuringUnitString(0, 'weight', $prodstatic->weight_units).'</td>'; ?>
<td class="center"><?php echo $prodstatic->getLibStatut(2, 0) ?></td>
<td class="center"><?php echo $prodstatic->getLibStatut(2, 1) ?></td>
<td class="right">
<a class="paddingleft paddingright" href="<?php echo dol_buildpath('/variants/combinations.php?id='.$id.'&action=edit&valueid='.$currcomb->id, 2) ?>"><?php echo img_edit() ?></a>
<a class="paddingleft paddingright" href="<?php echo dol_buildpath('/variants/combinations.php?id='.$id.'&action=delete&valueid='.$currcomb->id, 2) ?>"><?php echo img_delete() ?></a>
</td>
<?php
print '<td class="nowrap center">';
if ($productCombinations || $massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($prodstatic->id, $arrayofselected)) $selected=1;
print '<input id="cb'.$prodstatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$prodstatic->id.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
?>
</tr>
<?php
}
}
else
{
print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
?>
</table>
<?php <?php
print '</div>';
if (count($productCombinations))
{
foreach ($productCombinations as $currcomb)
{
$prodstatic->fetch($currcomb->fk_product_child);
print '<tr class="oddeven">';
print '<td>'.$prodstatic->getNomUrl(1).'</td>';
print '<td>';
$productCombination2ValuePairs = $comb2val->fetchByFkCombination($currcomb->id);
$iMax = count($productCombination2ValuePairs);
for ($i = 0; $i < $iMax; $i++) {
echo dol_htmlentities($productCombination2ValuePairs[$i]);
if ($i !== ($iMax - 1)) {
echo ', ';
}
}
print '</td>';
print '<td class="right">'.($currcomb->variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '').'</td>';
if ($object->isProduct()) {
print '<td class="right">'.($currcomb->variation_weight >= 0 ? '+' : '').price($currcomb->variation_weight).' '.measuringUnitString(0, 'weight', $prodstatic->weight_units).'</td>';
}
print '<td class="center">'.$prodstatic->getLibStatut(2, 0).'</td>';
print '<td class="center">'.$prodstatic->getLibStatut(2, 1).'</td>';
print '<td class="right">';
print '<a class="paddingleft paddingright" href="'.dol_buildpath('/variants/combinations.php?id='.$id.'&action=edit&valueid='.$currcomb->id, 2).'">'.img_edit().'</a>';
print '<a class="paddingleft paddingright" href="'.dol_buildpath('/variants/combinations.php?id='.$id.'&action=delete&valueid='.$currcomb->id, 2).'">'.img_delete().'</a>';
print '</td>';
print '<td class="nowrap center">';
if ($productCombinations || $massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
{
$selected=0;
if (in_array($prodstatic->id, $arrayofselected)) $selected=1;
print '<input id="cb'.$prodstatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$prodstatic->id.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
print '</tr>';
}
}
else
{
print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
print '</table>';
print '</div>';
print '</form>'; print '</form>';
} }
} else { } else {

View File

@@ -378,8 +378,8 @@ if (! empty($id) || ! empty($ref)) {
<?php <?php
// End of page // End of page
llxFooter(); llxFooter();
} }
$db->close(); $db->close();

View File

@@ -118,34 +118,29 @@ $forcereloadpage=empty($conf->global->MAIN_FORCE_RELOAD_PAGE)?0:1;
<th class="liste_titre right"><?php print $langs->trans('NbProducts') ?></th> <th class="liste_titre right"><?php print $langs->trans('NbProducts') ?></th>
<th class="liste_titre" colspan="2"></th> <th class="liste_titre" colspan="2"></th>
</tr> </tr>
<?php foreach ($variants as $key => $attribute): ?>
<tr id="row-<?php echo $attribute->id ?>" class="drag drop oddeven">
<td><a href="card.php?id=<?php echo $attribute->id ?>"><?php echo dol_htmlentities($attribute->ref) ?></a></td>
<td><a href="card.php?id=<?php echo $attribute->id ?>"><?php echo dol_htmlentities($attribute->label) ?></a></td>
<td class="right"><?php echo $attribute->countChildValues() ?></td>
<td class="right"><?php echo $attribute->countChildProducts() ?></td>
<td class="right">
<a href="card.php?id=<?php echo $attribute->id ?>&action=edit"><?php echo img_edit() ?></a>
<a href="card.php?id=<?php echo $attribute->id ?>&action=delete"><?php echo img_delete() ?></a>
</td>
<td class="center linecolmove tdlineupdown">
<?php if ($key > 0): ?>
<a class="lineupdown"
href="<?php echo $_SERVER['PHP_SELF'] ?>?action=up&amp;rowid=<?php echo $attribute->id ?>"><?php echo img_up('default', 0, 'imgupforline'); ?></a>
<?php endif ?>
<?php if ($key < count($variants)-1): ?>
<a class="lineupdown"
href="<?php echo $_SERVER['PHP_SELF'] ?>?action=down&amp;rowid=<?php echo $attribute->id ?>"><?php echo img_down('default', 0, 'imgdownforline'); ?></a>
<?php endif ?>
</td>
</tr>
<?php
endforeach
?>
</table>
<?php <?php
foreach ($variants as $key => $attribute) {
print '<tr id="row-'.$attribute->id.'" class="drag drop oddeven">';
print '<td><a href="card.php?id='.$attribute->id.'">'.dol_htmlentities($attribute->ref).'</a></td>';
print '<td><a href="card.php?id='.$attribute->id.'">'.dol_htmlentities($attribute->label).'</a></td>';
print '<td class="right">'.$attribute->countChildValues().'</td>';
print '<td class="right">'.$attribute->countChildProducts().'</td>';
print '<td class="right">';
print '<a href="card.php?id='.$attribute->id.'&action=edit">'.img_edit().'</a>';
print '<a href="card.php?id='.$attribute->id.'&action=delete">'.img_delete().'</a>';
print '</td>';
print '<td class="center linecolmove tdlineupdown">';
if ($key > 0) {
print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=up&amp;rowid='.$attribute->id.'">'.img_up('default', 0, 'imgupforline').'</a>';
}
if ($key < count($variants)-1) {
print '<a class="lineupdown" href="'.$_SERVER['PHP_SELF'].'?action=down&amp;rowid='.$attribute->id.'">'.img_down('default', 0, 'imgdownforline').'</a>';
}
print '</td>';
print "</tr>\n";
}
print '</table>';
// End of page // End of page
llxFooter(); llxFooter();

View File

@@ -218,49 +218,49 @@ function getCategory($authentication, $id)
$result=$categorie->fetch($id); $result=$categorie->fetch($id);
if ($result > 0) if ($result > 0)
{ {
$dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output); $dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output);
$pdir = get_exdir($categorie->id, 2, 0, 0, $categorie, 'category') . $categorie->id ."/photos/"; $pdir = get_exdir($categorie->id, 2, 0, 0, $categorie, 'category') . $categorie->id ."/photos/";
$dir = $dir . '/'. $pdir; $dir = $dir . '/'. $pdir;
$cat = array( $cat = array(
'id' => $categorie->id, 'id' => $categorie->id,
'id_mere' => $categorie->id_mere, 'id_mere' => $categorie->id_mere,
'label' => $categorie->label, 'label' => $categorie->label,
'description' => $categorie->description, 'description' => $categorie->description,
'socid' => $categorie->socid, 'socid' => $categorie->socid,
//'visible'=>$categorie->visible, //'visible'=>$categorie->visible,
'type' => $categorie->type, 'type' => $categorie->type,
'dir' => $pdir, 'dir' => $pdir,
'photos' => $categorie->liste_photos($dir, $nbmax) 'photos' => $categorie->liste_photos($dir, $nbmax)
); );
$cats = $categorie->get_filles(); $cats = $categorie->get_filles();
if (count($cats) > 0) if (count($cats) > 0)
{
foreach($cats as $fille)
{ {
foreach($cats as $fille) $dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output);
{ $pdir = get_exdir($fille->id, 2, 0, 0, $categorie, 'category') . $fille->id ."/photos/";
$dir = (!empty($conf->categorie->dir_output)?$conf->categorie->dir_output:$conf->service->dir_output); $dir = $dir . '/'. $pdir;
$pdir = get_exdir($fille->id, 2, 0, 0, $categorie, 'category') . $fille->id ."/photos/"; $cat['filles'][] = array(
$dir = $dir . '/'. $pdir; 'id'=>$fille->id,
$cat['filles'][] = array( 'id_mere' => $categorie->id_mere,
'id'=>$fille->id, 'label'=>$fille->label,
'id_mere' => $categorie->id_mere, 'description'=>$fille->description,
'label'=>$fille->label, 'socid'=>$fille->socid,
'description'=>$fille->description, //'visible'=>$fille->visible,
'socid'=>$fille->socid, 'type'=>$fille->type,
//'visible'=>$fille->visible, 'dir' => $pdir,
'type'=>$fille->type, 'photos' => $fille->liste_photos($dir, $nbmax)
'dir' => $pdir, );
'photos' => $fille->liste_photos($dir, $nbmax)
);
}
} }
}
// Create // Create
$objectresp = array( $objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''), 'result'=>array('result_code'=>'OK', 'result_label'=>''),
'categorie'=> $cat 'categorie'=> $cat
); );
} }
else else
{ {

View File

@@ -569,7 +569,7 @@ function createInvoice($authentication, $invoice)
$new_invoice->fk_project=$invoice['project_id']; $new_invoice->fk_project=$invoice['project_id'];
$new_invoice->date_creation=$now; $new_invoice->date_creation=$now;
//take mode_reglement and cond_reglement from thirdparty //take mode_reglement and cond_reglement from thirdparty
$soc = new Societe($db); $soc = new Societe($db);
$res=$soc->fetch($new_invoice->socid); $res=$soc->fetch($new_invoice->socid);
if ($res > 0) { if ($res > 0) {
@@ -660,7 +660,7 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = ''
$now=dol_now(); $now=dol_now();
dol_syslog("Function: createInvoiceFromOrder login=".$authentication['login']." id=".$id_order. dol_syslog("Function: createInvoiceFromOrder login=".$authentication['login']." id=".$id_order.
", ref=".$ref_order.", ref_ext=".$ref_ext_order); ", ref=".$ref_order.", ref_ext=".$ref_ext_order);
if ($authentication['entity']) $conf->entity=$authentication['entity']; if ($authentication['entity']) $conf->entity=$authentication['entity'];
@@ -743,7 +743,7 @@ function updateInvoice($authentication, $invoice)
{ {
global $db,$conf,$langs; global $db,$conf,$langs;
dol_syslog("Function: updateInvoice login=".$authentication['login']." id=".$invoice['id']. dol_syslog("Function: updateInvoice login=".$authentication['login']." id=".$invoice['id'].
", ref=".$invoice['ref'].", ref_ext=".$invoice['ref_ext']); ", ref=".$invoice['ref'].", ref_ext=".$invoice['ref_ext']);
if ($authentication['entity']) $conf->entity=$authentication['entity']; if ($authentication['entity']) $conf->entity=$authentication['entity'];

View File

@@ -151,41 +151,41 @@ function createPayment($authentication, $payment)
// Init and check authentication // Init and check authentication
$objectresp = array(); $objectresp = array();
$errorcode = ''; $errorcode = '';
$errorlabel = ''; $errorlabel = '';
$error = 0; $error = 0;
$fuser = check_authentication($authentication, $error, $errorcode, $errorlabel); $fuser = check_authentication($authentication, $error, $errorcode, $errorlabel);
// Check parameters // Check parameters
if (empty($payment['amount']) && empty($payment['thirdparty_id'])) { if (empty($payment['amount']) && empty($payment['thirdparty_id'])) {
$error++; $error++;
$errorcode ='KO'; $errorcode ='KO';
$errorlabel ="You must specify the amount and the third party's ID."; $errorlabel ="You must specify the amount and the third party's ID.";
} }
if (! $error) if (! $error)
{ {
$soc = new Societe($db); $soc = new Societe($db);
$res = $soc->fetch($payment['thirdparty_id']); $res = $soc->fetch($payment['thirdparty_id']);
$new_payment = new Paiement($db); $new_payment = new Paiement($db);
$new_payment->amount = doubleval($payment['amount']); $new_payment->amount = doubleval($payment['amount']);
$new_payment->num_paiement = $payment['num_paiement']; $new_payment->num_paiement = $payment['num_paiement'];
$new_payment->bank_account = intval($payment['bank_account']); $new_payment->bank_account = intval($payment['bank_account']);
$new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id; $new_payment->paiementid = !empty($payment['payment_mode_id']) ? intval($payment['payment_mode_id']) : $soc->mode_reglement_id;
$new_payment->datepaye = $now; $new_payment->datepaye = $now;
$new_payment->author = $payment['thirdparty_id']; $new_payment->author = $payment['thirdparty_id'];
$new_payment->amounts = array(); $new_payment->amounts = array();
if(intval($payment['invoice_id']) > 0) { if (intval($payment['invoice_id']) > 0) {
$new_payment->amounts[ $payment['invoice_id'] ] = $new_payment->amount; $new_payment->amounts[ $payment['invoice_id'] ] = $new_payment->amount;
} }
$db->begin(); $db->begin();
$result = $new_payment->create($fuser, true); $result = $new_payment->create($fuser, true);
if($payment['bank_account']) { if ($payment['bank_account']) {
$new_payment->addPaymentToBank($fuser, 'payment', $payment['int_label'], $payment['bank_account'], $payment['emitter'], $payment['bank_source']); $new_payment->addPaymentToBank($fuser, 'payment', $payment['int_label'], $payment['bank_account'], $payment['emitter'], $payment['bank_source']);
} }
if ($result < 0) if ($result < 0)
{ {

View File

@@ -505,7 +505,7 @@ function createProductOrService($authentication, $product)
if ($product['barcode'] && !$product['barcode_type']) if ($product['barcode'] && !$product['barcode_type'])
{ {
$errror++; $errorcode='KO' ; $errorlabel="You must set a barcode type when setting a barcode."; $errror++; $errorcode='KO' ; $errorlabel="You must set a barcode type when setting a barcode.";
} }
@@ -967,9 +967,9 @@ function getListOfProductsOrServices($authentication, $filterproduct)
$sql.=" WHERE entity=".$conf->entity; $sql.=" WHERE entity=".$conf->entity;
foreach($filterproduct as $key => $val) foreach($filterproduct as $key => $val)
{ {
if ($key == 'type' && $val >= 0) $sql.=" AND fk_product_type = ".$db->escape($val); if ($key == 'type' && $val >= 0) $sql.=" AND fk_product_type = ".$db->escape($val);
if ($key == 'status_tosell') $sql.=" AND tosell = ".$db->escape($val); if ($key == 'status_tosell') $sql.=" AND tosell = ".$db->escape($val);
if ($key == 'status_tobuy') $sql.=" AND tobuy = ".$db->escape($val); if ($key == 'status_tobuy') $sql.=" AND tobuy = ".$db->escape($val);
} }
$resql=$db->query($sql); $resql=$db->query($sql);
if ($resql) if ($resql)

View File

@@ -274,32 +274,32 @@ function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
$objectresp = array( $objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''), 'result'=>array('result_code'=>'OK', 'result_label'=>''),
'invoice'=>array( 'invoice'=>array(
'id' => $invoice->id, 'id' => $invoice->id,
'ref' => $invoice->ref, 'ref' => $invoice->ref,
'ref_supplier'=>$invoice->ref_supplier, 'ref_supplier'=>$invoice->ref_supplier,
'ref_ext' => $invoice->ref_ext, 'ref_ext' => $invoice->ref_ext,
'fk_user_author' => $invoice->fk_user_author, 'fk_user_author' => $invoice->fk_user_author,
'fk_user_valid' => $invoice->fk_user_valid, 'fk_user_valid' => $invoice->fk_user_valid,
'fk_thirdparty' => $invoice->fk_soc, 'fk_thirdparty' => $invoice->fk_soc,
'type'=>$invoice->type, 'type'=>$invoice->type,
'status'=>$invoice->statut, 'status'=>$invoice->statut,
'total_net'=>$invoice->total_ht, 'total_net'=>$invoice->total_ht,
'total_vat'=>$invoice->total_tva, 'total_vat'=>$invoice->total_tva,
'total'=>$invoice->total_ttc, 'total'=>$invoice->total_ttc,
'date_creation'=>dol_print_date($invoice->datec, 'dayhourrfc'), 'date_creation'=>dol_print_date($invoice->datec, 'dayhourrfc'),
'date_modification'=>dol_print_date($invoice->tms, 'dayhourrfc'), 'date_modification'=>dol_print_date($invoice->tms, 'dayhourrfc'),
'date_invoice'=>dol_print_date($invoice->date, 'dayhourrfc'), 'date_invoice'=>dol_print_date($invoice->date, 'dayhourrfc'),
'date_term'=>dol_print_date($invoice->date_echeance, 'dayhourrfc'), 'date_term'=>dol_print_date($invoice->date_echeance, 'dayhourrfc'),
'label'=>$invoice->libelle, 'label'=>$invoice->libelle,
'paid'=>$invoice->paye, 'paid'=>$invoice->paye,
'note_private'=>$invoice->note_private, 'note_private'=>$invoice->note_private,
'note_public'=>$invoice->note_public, 'note_public'=>$invoice->note_public,
'close_code'=>$invoice->close_code, 'close_code'=>$invoice->close_code,
'close_note'=>$invoice->close_note, 'close_note'=>$invoice->close_note,
'lines' => $linesresp 'lines' => $linesresp,
// 'lines' => array('0'=>array('id'=>222,'type'=>1), // 'lines' => array('0'=>array('id'=>222,'type'=>1),
// '1'=>array('id'=>333,'type'=>1)) // '1'=>array('id'=>333,'type'=>1)),
)); ));
} }

View File

@@ -334,7 +334,7 @@ class Website extends CommonObject
$sql .= $this->db->order($sortfield, $sortorder); $sql .= $this->db->order($sortfield, $sortorder);
} }
if (!empty($limit)) { if (!empty($limit)) {
$sql .= ' ' . $this->db->plimit($limit, $offset); $sql .= ' ' . $this->db->plimit($limit, $offset);
} }
$this->records = array(); $this->records = array();

View File

@@ -2375,14 +2375,14 @@ if (! GETPOST('hide_websitemenu'))
} }
else else
{*/ {*/
if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE)) if (empty($conf->global->WEBSITE_SUBCONTAINERSINLINE))
{ {
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>'; print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=setshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("Off")), 'switch_off', '', false, 0, 0, '', 'nomarginleft').'</a>';
} }
else else
{ {
print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>'; print '<a class="button nobordertransp nohoverborder"'.$disabled.' href="'.$_SERVER["PHP_SELF"].'?website='.$object->ref.'&pageid='.$websitepage->id.'&action=unsetshowsubcontainers">'.img_picto($langs->trans("ShowSubContainersOnOff", $langs->transnoentitiesnoconv("On")), 'switch_on', '', false, 0, 0, '', 'nomarginleft').'</a>';
} }
/*}*/ /*}*/
print '</div>'; print '</div>';
print '</div>'; print '</div>';