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 -->
<!-- Disabled as this does not support tab -->
<!-- <rule ref="Generic.WhiteSpace.ScopeIndent" /> -->
<!-- TODO Enable this
<arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
@@ -194,7 +194,7 @@
<property name="tabIndent" value="true"/>
</properties>
</rule>
-->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace.Indent" />

View File

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

View File

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

View File

@@ -31,19 +31,19 @@ header('Content-Type: application/json');
$id = GETPOST('id');
if (!$id) {
print json_encode(array(
'error' => 'ID not set'
));
exit();
print json_encode(array(
'error' => 'ID not set'
));
exit();
}
$prodattr = new ProductAttribute($db);
if ($prodattr->fetch($id) < 0) {
print json_encode(array(
'error' => 'Attribute not found'
));
exit();
print json_encode(array(
'error' => 'Attribute not found'
));
exit();
}
$prodattrval = new ProductAttributeValue($db);
@@ -51,10 +51,10 @@ $prodattrval = new ProductAttributeValue($db);
$res = $prodattrval->fetchAllByProductAttribute($id);
if ($res == -1) {
print json_encode(array(
'error' => 'Internal error'
));
exit();
print json_encode(array(
'error' => 'Internal error'
));
exit();
}
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="underbanner clearboth"></div>';
}
?>
<table class="border" style="width: 100%">
<tr>
<td class="titlefield fieldrequired"><?php echo $langs->trans('Ref') ?></td>
<td>
<?php if ($action == 'edit') {
print '<input type="text" name="ref" value="'.$object->ref.'">';
} else {
print dol_htmlentities($object->ref);
} ?>
</td>
</tr>
<tr>
<td class="fieldrequired"><?php echo $langs->trans('Label') ?></td>
<td>
<?php if ($action == 'edit') {
print '<input type="text" name="label" value="'.$object->label.'">';
} else {
print dol_htmlentities($object->label);
} ?>
</td>
</tr>
print '<table class="border" style="width: 100%">';
print '<tr>';
print '<td class="titlefield fieldrequired">'.$langs->trans('Ref').'</td>';
print '<td>';
if ($action == 'edit') {
print '<input type="text" name="ref" value="'.$object->ref.'">';
} else {
print dol_htmlentities($object->ref);
}
print '</td>';
print '</tr>';
print '<tr>';
print '<td class="fieldrequired">'.$langs->trans('Label').'</td>';
print '<td>';
if ($action == 'edit') {
print '<input type="text" name="label" value="'.$object->label.'">';
} else {
print dol_htmlentities($object->label);
}
print '</td>';
print '</tr>';
</table>
print '</table>';
<?php
if ($action != 'edit')
{
if ($action != 'edit') {
print '</div>';
}
dol_fiche_end();
if ($action == 'edit') { ?>
<div style="text-align: center;">
<div class="inline-block divButAction">
<input type="submit" class="button" value="<?php echo $langs->trans('Save') ?>">
&nbsp; &nbsp;
<input type="submit" class="button" name="cancel" value="<?php echo $langs->trans('Cancel') ?>">
</div>
</div></form>
<?php } else {
if ($action == 'edit') {
print '<div style="text-align: center;">';
print '<div class="inline-block divButAction">';
print '<input type="submit" class="button" value="'.$langs->trans('Save').'">';
print '&nbsp; &nbsp;';
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans('Cancel').'">';
print '</div>';
print '</div></form>';
} else {
if ($action == 'delete') {
$form = new Form($db);
print $form->formconfirm(
print $form->formconfirm(
"card.php?id=".$object->id,
$langs->trans('Delete'),
$langs->trans('ProductAttributeDeleteDialog'),
@@ -208,7 +204,7 @@ print $form->formconfirm(
if ($objectval->fetch($valueid) > 0) {
$form = new Form($db);
print $form->formconfirm(
print $form->formconfirm(
"card.php?id=".$object->id."&valueid=".$objectval->id,
$langs->trans('Delete'),
$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="valueid" value="'.$valueid.'">';
print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
} ?>
}
<table class="liste">
<tr class="liste_titre">
<th class="liste_titre titlefield"><?php echo $langs->trans('Ref') ?></th>
<th class="liste_titre"><?php echo $langs->trans('Value') ?></th>
<th class="liste_titre"></th>
</tr>
print '<table class="liste">';
print '<tr class="liste_titre">';
print '<th class="liste_titre titlefield">'.$langs->trans('Ref').'</th>';
print '<th class="liste_titre">'.$langs->trans('Value').'</th>';
print '<th class="liste_titre"></th>';
print '</tr>';
<?php
foreach ($objectval->fetchAllByProductAttribute($object->id) as $attrval) {
?>
<tr class="oddeven">
<?php if ($action == 'edit_value' && ($valueid == $attrval->id)): ?>
foreach ($objectval->fetchAllByProductAttribute($object->id) as $attrval) {
print '<tr class="oddeven">';
if ($action == 'edit_value' && ($valueid == $attrval->id)) {
?>
<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 class="right">
@@ -262,31 +257,30 @@ print $form->formconfirm(
&nbsp; &nbsp;
<input type="submit" name="cancel" value="<?php echo $langs->trans('Cancel') ?>" class="button">
</td>
<?php else: ?>
<?php
} else {
?>
<td><?php echo dol_htmlentities($attrval->ref) ?></td>
<td><?php echo dol_htmlentities($attrval->value) ?></td>
<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=delete_value&valueid=<?php echo $attrval->id ?>"><?php echo img_delete() ?></a>
</td>
<?php endif; ?>
</tr>
<?php
<?php
}
?>
</table>
print '</tr>';
}
print '</table>';
<?php if ($action == 'edit_value'): ?>
</form>
<?php endif ?>
if ($action == 'edit_value') {
print '</form>';
}
<div class="tabsAction">
<div class="inline-block divButAction">
<a href="create_val.php?id=<?php echo $object->id ?>" class="butAction"><?php echo $langs->trans('Create') ?></a>
</div>
</div>
<?php
print '<div class="tabsAction">';
print '<div class="inline-block divButAction">';
print '<a href="create_val.php?id='.$object->id.'" class="butAction">'.$langs->trans('Create').'</a>';
print '</div>';
print '</div>';
}
// 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)) {
$newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref;
$newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref;
} else {
$newproduct->ref .= '_'.$prodattrval->ref;
$newproduct->ref .= '_'.$prodattrval->ref;
}
//The first one should not contain a linebreak

View File

@@ -425,7 +425,7 @@ if (! empty($id) || ! empty($ref))
<?php
foreach ($productCombination2ValuePairs1 as $pc2v) {
$prodattr_val->fetch($pc2v->fk_prod_attr_val);
?>
?>
variants_selected.index.push(<?php echo $pc2v->fk_prod_attr ?>);
variants_selected.info[<?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 ?>'
}
};
<?php
<?php
}
?>
@@ -484,7 +484,7 @@ if (! empty($id) || ! empty($ref))
});
</script>
<?php
<?php
}
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="id" value="'.dol_escape_htmltag($id).'">'."\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 dol_fiche_head();
?>
<table class="border" style="width: 100%">
<?php if ($action == 'add') { ?>
<!-- Variant -->
<tr>
<td class="titlefieldcreate fieldrequired"><label for="attribute"><?php echo $langs->trans('ProductAttribute') ?></label></td>
<td>
<?php
if (is_array($prodattr_all))
{
print '<select class="flat minwidth100" id="attribute" name="attribute">';
print '<option value="-1">&nbsp;</option>';
foreach ($prodattr_all as $attr)
{
//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 '<table class="border" style="width: 100%">';
if ($action == 'add') {
print "<!-- Variant -->\n";
print '<tr>';
print '<td class="titlefieldcreate fieldrequired"><label for="attribute">'.$langs->trans('ProductAttribute').'</label></td>';
print '<td>';
if (is_array($prodattr_all)) {
print '<select class="flat minwidth100" id="attribute" name="attribute">';
print '<option value="-1">&nbsp;</option>';
foreach ($prodattr_all as $attr) {
//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>';
}
$htmltext=$langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes"));
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 $langs->trans("Create");
print '</a>';*/
$htmltext=$langs->trans("GoOnMenuToCreateVairants", $langs->transnoentities("Product"), $langs->transnoentities("VariantAttributes"));
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 $langs->trans("Create");
print '</a>';*/
?>
?>
</td>
</tr>
<!-- Value -->
@@ -555,15 +551,14 @@ if (! empty($id) || ! empty($ref))
</td>
</tr>
<tr><td></td><td>
<?php echo $listofvariantselected; ?>
</td>
</tr>
</table>
<?php
}
<?php echo $listofvariantselected;
print '</td>';
print '</tr>';
print '</table>';
}
if (is_array($productCombination2ValuePairs1)) {
?>
?>
<hr>
<table class="border" style="width: 100%">
<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) ?>">
<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>
<?php
<?php
if ($object->isProduct()) {
print '<tr>';
print '<td><label for="weight_impact">'.$langs->trans('WeightImpact').'</label></td>';
@@ -644,7 +639,7 @@ if (! empty($id) || ! empty($ref))
if ($productCombinations)
{
?>
?>
<script type="text/javascript">
jQuery(document).ready(function() {
@@ -751,62 +746,54 @@ if (! empty($id) || ! empty($ref))
print '</td>';
?>
</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
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>';
}
} else {

View File

@@ -378,8 +378,8 @@ if (! empty($id) || ! empty($ref)) {
<?php
// End of page
llxFooter();
// End of page
llxFooter();
}
$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" colspan="2"></th>
</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
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
llxFooter();

View File

@@ -218,49 +218,49 @@ function getCategory($authentication, $id)
$result=$categorie->fetch($id);
if ($result > 0)
{
$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/";
$dir = $dir . '/'. $pdir;
$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/";
$dir = $dir . '/'. $pdir;
$cat = array(
'id' => $categorie->id,
'id_mere' => $categorie->id_mere,
'label' => $categorie->label,
'description' => $categorie->description,
'socid' => $categorie->socid,
//'visible'=>$categorie->visible,
'type' => $categorie->type,
'dir' => $pdir,
'photos' => $categorie->liste_photos($dir, $nbmax)
);
$cat = array(
'id' => $categorie->id,
'id_mere' => $categorie->id_mere,
'label' => $categorie->label,
'description' => $categorie->description,
'socid' => $categorie->socid,
//'visible'=>$categorie->visible,
'type' => $categorie->type,
'dir' => $pdir,
'photos' => $categorie->liste_photos($dir, $nbmax)
);
$cats = $categorie->get_filles();
if (count($cats) > 0)
$cats = $categorie->get_filles();
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 = $dir . '/'. $pdir;
$cat['filles'][] = array(
'id'=>$fille->id,
'id_mere' => $categorie->id_mere,
'label'=>$fille->label,
'description'=>$fille->description,
'socid'=>$fille->socid,
//'visible'=>$fille->visible,
'type'=>$fille->type,
'dir' => $pdir,
'photos' => $fille->liste_photos($dir, $nbmax)
);
}
$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 = $dir . '/'. $pdir;
$cat['filles'][] = array(
'id'=>$fille->id,
'id_mere' => $categorie->id_mere,
'label'=>$fille->label,
'description'=>$fille->description,
'socid'=>$fille->socid,
//'visible'=>$fille->visible,
'type'=>$fille->type,
'dir' => $pdir,
'photos' => $fille->liste_photos($dir, $nbmax)
);
}
}
// Create
$objectresp = array(
'result'=>array('result_code'=>'OK', 'result_label'=>''),
'categorie'=> $cat
);
);
}
else
{

View File

@@ -569,7 +569,7 @@ function createInvoice($authentication, $invoice)
$new_invoice->fk_project=$invoice['project_id'];
$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);
$res=$soc->fetch($new_invoice->socid);
if ($res > 0) {
@@ -660,7 +660,7 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = ''
$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);
if ($authentication['entity']) $conf->entity=$authentication['entity'];
@@ -743,7 +743,7 @@ function updateInvoice($authentication, $invoice)
{
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']);
if ($authentication['entity']) $conf->entity=$authentication['entity'];

View File

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

View File

@@ -505,7 +505,7 @@ function createProductOrService($authentication, $product)
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;
foreach($filterproduct as $key => $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_tobuy') $sql.=" AND tobuy = ".$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_tobuy') $sql.=" AND tobuy = ".$db->escape($val);
}
$resql=$db->query($sql);
if ($resql)

View File

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

View File

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

View File

@@ -2375,14 +2375,14 @@ if (! GETPOST('hide_websitemenu'))
}
else
{*/
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>';
}
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>';
}
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>';
}
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 '</div>';
print '</div>';