diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index 061b98d1e9c54f5b318882f3ec52fbc8b21328dc..dbf446d21125f665142e1393f488d43b76a740fd 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -36,7 +36,7 @@ if ($action == 'print_file' and $user->rights->printing->read) $list = $objectprint->listDrivers($db, 10); if (! empty($list)) { $errorprint=0; - $printed=0; + $printerfound=0; foreach ($list as $driver) { require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; $langs->load($driver); @@ -46,27 +46,35 @@ if ($action == 'print_file' and $user->rights->printing->read) if (! empty($conf->global->{$printer->active})) { + $printerfound++; + $subdir=(GETPOST('printer', 'alpha')=='expedition'?'sending':''); $module = GETPOST('printer', 'alpha'); if ($module =='commande_fournisseur') { $module = 'fournisseur'; $subdir = 'commande'; } - $ret = $printer->print_file(GETPOST('file', 'alpha'), $module, $subdir); - if ($ret > 0) { - //print '<pre>'.print_r($printer->errors, true).'</pre>'; - setEventMessages($printer->error, $printer->errors, 'errors'); + try { + $ret = $printer->print_file(GETPOST('file', 'alpha'), $module, $subdir); + if ($ret > 0) { + //print '<pre>'.print_r($printer->errors, true).'</pre>'; + setEventMessages($printer->error, $printer->errors, 'errors'); + } + if ($ret==0) + { + //print '<pre>'.print_r($printer->errors, true).'</pre>'; + setEventMessages($printer->error, $printer->errors); + setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); + } } - if ($ret==0) + catch(Exception $e) { - //print '<pre>'.print_r($printer->errors, true).'</pre>'; - setEventMessages($printer->error, $printer->errors); - setEventMessages($langs->trans("FileWasSentToPrinter", basename(GETPOST('file'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); - $printed++; + $ret = 1; + setEventMessages($e->getMessage(), null, 'errors'); } } } - if ($printed==0) setEventMessages($langs->trans("NoActivePrintingModuleFound"), null, 'warnings'); + if ($printerfound==0) setEventMessages($langs->trans("NoActivePrintingModuleFound"), null, 'warnings'); } else { setEventMessages($langs->trans("NoModuleFound"), null, 'warnings'); } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 9dba03c597866bb54ac90bbfeb650b11659ad071..b0249452a7001f2bbee4db74f59ad757039b1f66 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -2205,7 +2205,7 @@ table.borderplus { border: 1px solid #BBB; } .border tbody tr, .border tbody tr td, div.tabBar table.border tr, div.tabBar table.border tr td, div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar div.border .table-val-border-col { - height: 20px; + height: 22px; } div.tabBar div.border .table-border-row, div.tabBar div.border .table-key-border-col, div.tabBar .table-val-border-col { vertical-align: middle; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 546cff1d9c7faa14290d18f213a93faf9defe86e..a4341ab317d50b30c0607e903c3ac5359aae21d6 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2292,7 +2292,7 @@ table.borderplus { } .border tbody tr, .border tbody tr td, div.tabBar table.border tr { - height: 20px; + height: 22px; } table.border td, div.border div div.tagtd { diff --git a/htdocs/variants/card.php b/htdocs/variants/card.php index ae921114d6b98078d1095901c01c3edfd40074e4..a611767cf2f56dfea40bd7eb6f019b836f0fe818 100644 --- a/htdocs/variants/card.php +++ b/htdocs/variants/card.php @@ -1,5 +1,4 @@ <?php - /* Copyright (C) 2016 Marcos GarcĂa <marcosgdf@gmail.com> * * This program is free software; you can redistribute it and/or modify @@ -28,10 +27,10 @@ $ref = GETPOST('ref'); $confirm = GETPOST('confirm'); $cancel = GETPOST('cancel'); -$prodattr = new ProductAttribute($db); -$prodattrval = new ProductAttributeValue($db); +$object = new ProductAttribute($db); +$objectval = new ProductAttributeValue($db); -if ($prodattr->fetch($id) < 1) { +if ($object->fetch($id) < 1) { dol_print_error($db, $langs->trans('ErrorRecordNotFound')); exit(); } @@ -47,10 +46,10 @@ if ($_POST) { if ($action == 'edit') { - $prodattr->label = $label; - $prodattr->ref = $ref; + $object->label = $label; + $object->ref = $ref; - if ($prodattr->update() < 1) { + if ($object->update() < 1) { setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); } else { setEventMessage($langs->trans('RecordSaved')); @@ -59,19 +58,19 @@ if ($_POST) { } } elseif ($action == 'edit_value') { - if ($prodattrval->fetch($valueid) > 0) { + if ($objectval->fetch($valueid) > 0) { - $prodattrval->ref = $ref; - $prodattrval->value = GETPOST('value'); + $objectval->ref = $ref; + $objectval->value = GETPOST('value'); - if ($prodattrval->update() > 0) { + if ($objectval->update() > 0) { setEventMessage($langs->trans('RecordSaved')); } else { setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); } } - header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2)); + header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2)); exit(); } @@ -82,12 +81,12 @@ if ($confirm == 'yes') { $db->begin(); - $res = $prodattrval->deleteByFkAttribute($prodattr->id); + $res = $objectval->deleteByFkAttribute($object->id); - if ($res < 1 || ($prodattr->delete() < 1)) { + if ($res < 1 || ($object->delete() < 1)) { $db->rollback(); setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); - header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2)); + header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2)); } else { $db->commit(); setEventMessage($langs->trans('RecordSaved')); @@ -97,15 +96,15 @@ if ($confirm == 'yes') { exit(); } elseif ($action == 'confirm_deletevalue') { - if ($prodattrval->fetch($valueid) > 0) { + if ($objectval->fetch($valueid) > 0) { - if ($prodattrval->delete() < 1) { + if ($objectval->delete() < 1) { setEventMessage($langs->trans('CoreErrorMessage'), 'errors'); } else { setEventMessage($langs->trans('RecordSaved')); } - header('Location: '.dol_buildpath('/variants/card.php?id='.$prodattr->id, 2)); + header('Location: '.dol_buildpath('/variants/card.php?id='.$object->id, 2)); exit(); } } @@ -118,38 +117,50 @@ if ($confirm == 'yes') { $langs->load('products'); -$title = $langs->trans('ProductAttributeName', dol_htmlentities($prodattr->label)); +$title = $langs->trans('ProductAttributeName', dol_htmlentities($object->label)); $var = false; llxHeader('', $title); -print_fiche_titre($title); +//print_fiche_titre($title); + +$h=0; +$head[$h][0] = DOL_URL_ROOT.'/variants/card.php?id='.$object->id; +$head[$h][1] = $langs->trans("Card"); +$head[$h][2] = 'variant'; +$h++; -dol_fiche_head(); +dol_fiche_head($head, 'variant', $langs->trans('ProductAttributeName'), -1, 'generic'); if ($action == 'edit') { - print '<form method="post">'; + print '<form method="POST">'; } + +if ($action != 'edit') +{ + print '<div class="fichecenter">'; + print '<div class="underbanner clearboth"></div>'; +} ?> <table class="border" style="width: 100%"> <tr> - <td style="width: 15%" class="fieldrequired"><?php echo $langs->trans('Ref') ?></td> + <td class="titlefield fieldrequired"><?php echo $langs->trans('Ref') ?></td> <td> <?php if ($action == 'edit') { - print '<input type="text" name="ref" value="'.$prodattr->ref.'">'; + print '<input type="text" name="ref" value="'.$object->ref.'">'; } else { - print dol_htmlentities($prodattr->ref); + print dol_htmlentities($object->ref); } ?> </td> </tr> <tr> - <td style="width: 15%" class="fieldrequired"><?php echo $langs->trans('Label') ?></td> + <td class="fieldrequired"><?php echo $langs->trans('Label') ?></td> <td> <?php if ($action == 'edit') { - print '<input type="text" name="label" value="'.$prodattr->label.'">'; + print '<input type="text" name="label" value="'.$object->label.'">'; } else { - print dol_htmlentities($prodattr->label); + print dol_htmlentities($object->label); } ?> </td> </tr> @@ -157,6 +168,12 @@ if ($action == 'edit') { </table> <?php + +if ($action != 'edit') +{ + print '</div>'; +} + dol_fiche_end(); if ($action == 'edit') { ?> @@ -173,7 +190,7 @@ if ($action == 'edit') { ?> $form = new Form($db); print $form->formconfirm( - "card.php?id=".$prodattr->id, + "card.php?id=".$object->id, $langs->trans('Delete'), $langs->trans('ProductAttributeDeleteDialog'), "confirm_delete", @@ -183,14 +200,14 @@ if ($action == 'edit') { ?> ); } elseif ($action == 'delete_value') { - if ($prodattrval->fetch($valueid) > 0) { + if ($objectval->fetch($valueid) > 0) { $form = new Form($db); print $form->formconfirm( - "card.php?id=".$prodattr->id."&valueid=".$prodattrval->id, + "card.php?id=".$object->id."&valueid=".$objectval->id, $langs->trans('Delete'), - $langs->trans('ProductAttributeValueDeleteDialog', dol_htmlentities($prodattrval->value), dol_htmlentities($prodattrval->ref)), + $langs->trans('ProductAttributeValueDeleteDialog', dol_htmlentities($objectval->value), dol_htmlentities($objectval->ref)), "confirm_deletevalue", '', 0, @@ -203,8 +220,8 @@ if ($action == 'edit') { ?> <div class="tabsAction"> <div class="inline-block divButAction"> - <a href="card.php?id=<?php echo $prodattr->id ?>&action=edit" class="butAction"><?php echo $langs->trans('Modify') ?></a> - <a href="card.php?id=<?php echo $prodattr->id ?>&action=delete" class="butAction"><?php echo $langs->trans('Delete') ?></a> + <a href="card.php?id=<?php echo $object->id ?>&action=edit" class="butAction"><?php echo $langs->trans('Modify') ?></a> + <a href="card.php?id=<?php echo $object->id ?>&action=delete" class="butAction"><?php echo $langs->trans('Delete') ?></a> </div> </div> @@ -219,7 +236,7 @@ if ($action == 'edit') { ?> <th class="liste_titre"></th> </tr> - <?php foreach ($prodattrval->fetchAllByProductAttribute($prodattr->id) as $attrval): ?> + <?php foreach ($objectval->fetchAllByProductAttribute($object->id) as $attrval): ?> <tr <?php echo $bc[!$var] ?>> <?php if ($action == 'edit_value' && ($valueid == $attrval->id)): ?> <td><input type="text" name="ref" value="<?php echo $attrval->ref ?>"></td> @@ -233,8 +250,8 @@ if ($action == 'edit') { ?> <td><?php echo dol_htmlentities($attrval->ref) ?></td> <td><?php echo dol_htmlentities($attrval->value) ?></td> <td style="text-align: right"> - <a href="card.php?id=<?php echo $prodattr->id ?>&action=edit_value&valueid=<?php echo $attrval->id ?>"><?php echo img_edit() ?></a> - <a href="card.php?id=<?php echo $prodattr->id ?>&action=delete_value&valueid=<?php echo $attrval->id ?>"><?php echo img_delete() ?></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> </td> <?php endif; ?> </tr> @@ -250,7 +267,7 @@ if ($action == 'edit') { ?> <div class="tabsAction"> <div class="inline-block divButAction"> - <a href="create_val.php?id=<?php echo $prodattr->id ?>" class="butAction"><?php echo $langs->trans('Create') ?></a> + <a href="create_val.php?id=<?php echo $object->id ?>" class="butAction"><?php echo $langs->trans('Create') ?></a> </div> </div> @@ -258,3 +275,4 @@ if ($action == 'edit') { ?> } llxFooter(); +$db->close();