--- /tmp/dsg/dolibarr/htdocs/product/dynamic_price/github_editor.php +++ /tmp/dsg/dolibarr/htdocs/product/dynamic_price/client_editor.php @@ -33,7 +33,7 @@ $id = GETPOST('id', 'int'); $eid = GETPOST('eid', 'int'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'alpha'); $title = GETPOST('expression_title', 'alpha'); $expression = GETPOST('expression'); $tab = GETPOST('tab', 'alpha'); @@ -54,7 +54,8 @@ if (empty($eid)) //This also disables fetch when eid == 0 { $eid = 0; -} elseif ($action != 'delete') +} +elseif ($action != 'delete') { $price_expression->fetch($eid); } @@ -76,7 +77,9 @@ $price_result = $priceparser->testExpression($id, $expression); if ($price_result < 0) { //Expression is not valid setEventMessages($priceparser->translatedError(), null, 'errors'); - } else { + } + else + { $price_expression->title = $title; $price_expression->expression = $expression; $result = $price_expression->create($user); @@ -84,14 +87,19 @@ { $eid = $price_expression->id; setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } else { + } + else + { setEventMessages("add: ".$price_expression->error, $price_expression->errors, 'errors'); } } - } elseif ($result < 0) + } + elseif ($result < 0) { setEventMessages("add find: ".$price_expression->error, $price_expression->errors, 'errors'); - } else { + } + else + { setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors'); } } @@ -109,7 +117,9 @@ $price_result = $priceparser->testExpression($id, $expression); if ($price_result < 0) { //Expression is not valid setEventMessages($priceparser->translatedError(), null, 'errors'); - } else { + } + else + { $price_expression->id = $eid; $price_expression->title = $title; $price_expression->expression = $expression; @@ -117,14 +127,19 @@ if ($result < 0) { setEventMessages("update: ".$price_expression->error, $price_expression->errors, 'errors'); - } else { + } + else + { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } } - } elseif ($result < 0) + } + elseif ($result < 0) { setEventMessages("update find: ".$price_expression->error, $price_expression->errors, 'errors'); - } else { + } + else + { setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors'); } } @@ -160,7 +175,7 @@ print ''; print ''; -print dol_get_fiche_head(); +dol_fiche_head(); print ''; @@ -196,17 +211,19 @@ print ''; print '
'; -print dol_get_fiche_end(); +dol_fiche_end(); //Buttons print '
'; -print ''; +print ''; print ''.$langs->trans("Back").''; if ($eid == 0) { print '
'.$langs->trans('Delete').'
'."\n"; -} else { - print '
'.$langs->trans("Delete").'
'; +} +else +{ + print '
'.$langs->trans("Delete").'
'; } print '
';