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

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

View File

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

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 '<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 {
} else {
print dol_htmlentities($object->ref);
} ?>
</td>
</tr>
<tr>
<td class="fieldrequired"><?php echo $langs->trans('Label') ?></td>
<td>
<?php if ($action == 'edit') {
}
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 {
} else {
print dol_htmlentities($object->label);
} ?>
</td>
</tr>
}
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) {
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="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
}
?>
</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

@@ -495,27 +495,23 @@ 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 '<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)
{
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>';
}
@@ -555,11 +551,10 @@ 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)) {
@@ -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>';
@@ -758,32 +753,30 @@ if (! empty($id) || ! empty($ref))
foreach ($productCombinations as $currcomb)
{
$prodstatic->fetch($currcomb->fk_product_child);
?>
<tr class="oddeven">
<td><?php echo $prodstatic->getNomUrl(1) ?></td>
<td>
<?php
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 ', ';
}
} ?>
</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>';
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
{
@@ -792,21 +785,15 @@ if (! empty($id) || ! empty($ref))
print '<input id="cb'.$prodstatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$prodstatic->id.'"'.($selected?' checked="checked"':'').'>';
}
print '</td>';
?>
</tr>
<?php
print '</tr>';
}
}
else
{
print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
?>
</table>
<?php
print '</table>';
print '</div>';
print '</form>';
}
} else {

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

@@ -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

@@ -176,14 +176,14 @@ function createPayment($authentication, $payment)
$new_payment->author = $payment['thirdparty_id'];
$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;
}
$db->begin();
$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']);
}

View File

@@ -297,9 +297,9 @@ function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '')
'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)),
));
}