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

@@ -144,54 +144,50 @@ 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);
} ?> }
</td> print '</td>';
</tr> print '</tr>';
<tr> print '<tr>';
<td class="fieldrequired"><?php echo $langs->trans('Label') ?></td> print '<td class="fieldrequired">'.$langs->trans('Label').'</td>';
<td> print '<td>';
<?php if ($action == 'edit') { 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);
} ?> }
</td> print '</td>';
</tr> print '</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);
@@ -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; ?>
</tr>
<?php <?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

@@ -501,21 +501,17 @@ if (! empty($id) || ! empty($ref))
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 '<select class="flat minwidth100" id="attribute" name="attribute">';
print '<option value="-1">&nbsp;</option>'; 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->id == GETPOST('attribute', 'int') ? ' selected="selected"' : '').'>'.$attr->label.'</option>';
print '<option value="'.$attr->id.'">'.$attr->label.'</option>'; print '<option value="'.$attr->id.'">'.$attr->label.'</option>';
} }
@@ -555,11 +551,10 @@ 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)) {
@@ -758,32 +753,30 @@ if (! empty($id) || ! empty($ref))
foreach ($productCombinations as $currcomb) foreach ($productCombinations as $currcomb)
{ {
$prodstatic->fetch($currcomb->fk_product_child); $prodstatic->fetch($currcomb->fk_product_child);
?> print '<tr class="oddeven">';
<tr class="oddeven"> print '<td>'.$prodstatic->getNomUrl(1).'</td>';
<td><?php echo $prodstatic->getNomUrl(1) ?></td> print '<td>';
<td>
<?php
$productCombination2ValuePairs = $comb2val->fetchByFkCombination($currcomb->id); $productCombination2ValuePairs = $comb2val->fetchByFkCombination($currcomb->id);
$iMax = count($productCombination2ValuePairs); $iMax = count($productCombination2ValuePairs);
for ($i = 0; $i < $iMax; $i++) { for ($i = 0; $i < $iMax; $i++) {
echo dol_htmlentities($productCombination2ValuePairs[$i]); echo dol_htmlentities($productCombination2ValuePairs[$i]);
if ($i !== ($iMax - 1)) { if ($i !== ($iMax - 1)) {
echo ', '; echo ', ';
} }
} ?> }
</td> print '</td>';
<td class="right"><?php echo ($currcomb->variation_price >= 0 ? '+' : '').price($currcomb->variation_price).($currcomb->variation_price_percentage ? ' %' : '') ?></td> print '<td class="right">'.($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>'; ?> if ($object->isProduct()) {
<td class="center"><?php echo $prodstatic->getLibStatut(2, 0) ?></td> 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, 1) ?></td> }
<td class="right"> print '<td class="center">'.$prodstatic->getLibStatut(2, 0).'</td>';
<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> print '<td class="center">'.$prodstatic->getLibStatut(2, 1).'</td>';
<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> print '<td class="right">';
</td> print '<a class="paddingleft paddingright" href="'.dol_buildpath('/variants/combinations.php?id='.$id.'&action=edit&valueid='.$currcomb->id, 2).'">'.img_edit().'</a>';
<?php 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">'; 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 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 '<input id="cb'.$prodstatic->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$prodstatic->id.'"'.($selected?' checked="checked"':'').'>';
} }
print '</td>'; print '</td>';
?> print '</tr>';
</tr>
<?php
} }
} }
else else
{ {
print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>'; print '<tr><td colspan="8"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
} }
?> print '</table>';
</table>
<?php
print '</div>'; print '</div>';
print '</form>'; print '</form>';
} }
} else { } 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 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 <?php
endforeach 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";
}
</table> print '</table>';
<?php
// End of page // End of page
llxFooter(); llxFooter();

View File

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