Skip to content

Commit

Permalink
Merge pull request #235 from cptechinc/hotfixes
Browse files Browse the repository at this point in the history
Hotfixes
  • Loading branch information
Pauldro authored Jun 5, 2023
2 parents acdc5bc + 83189d8 commit cb783aa
Show file tree
Hide file tree
Showing 48 changed files with 590 additions and 165 deletions.
8 changes: 4 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions site/modules/Dplus/InputValidator/InputValidator.module
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class InputValidator extends WireData implements Module {
if (strlen($values->text($field->input())) == 0 && $field->allow_blank()) {
return true;
}
return $this->validate->$function($values->text($field->input()));
return $this->validate->$function($values->string($field->input()));
}

/**
Expand Down Expand Up @@ -158,7 +158,7 @@ class InputValidator extends WireData implements Module {
if (strlen($values->text($field->input()))) {
$function = $field->function();

if ($this->validate->$function($values->text($field->input()))) {
if ($this->validate->$function($values->string($field->input()))) {
$this->set_property($field);
}
} elseif ($field->allow_blank && strlen($values->text($field->input())) == 0) {
Expand All @@ -176,7 +176,7 @@ class InputValidator extends WireData implements Module {
$rm = strtolower($this->input->requestMethod());
$values = $this->input->$rm;
$setProperty = "set".ucfirst($field->property());
$this->record->$setProperty($values->text($field->input(), $opt = ['maxLength' => $field->length]));
$this->record->$setProperty($values->string($field->input(), $opt = ['maxLength' => $field->length]));
}

/* =============================================================
Expand Down
2 changes: 1 addition & 1 deletion site/modules/Dplus/Mso/SalesOrderEdit.module
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class SalesOrderEdit extends WireData implements Module {
$rm = strtolower($input->requestMethod());
$values = $input->$rm;
$ordn = SalesOrder::get_paddedordernumber($values->text('ordn'));
$itemID = $values->text('itemID');
$itemID = $values->string('itemID');
$qty = $values->float('qty', ['precision' => $config->decimal_places_qty]);
$price = $values->float('price', ['precision' => $config->decimal_places_price]);
$this->request_so_add_detail($ordn, $itemID, $qty, $price);
Expand Down
20 changes: 19 additions & 1 deletion site/modules/Dplus/Xrefs/XrefMxrfe.module
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,31 @@ class XrefMxrfe extends WireData implements Module {

$record->setPrice($values->float('price'), ['precision' => $this->field_attribute('price', 'precision')]);
$record->setCost($values->float('cost'), ['precision' => $this->field_attribute('cost', 'precision')]);
$record->setDateupdated(date('Ymd'));
$this->updateDateUpdatedIfUpdatedCostOrPrice($record);
$record->setDate(date('Ymd'));
$record->setTime(date('His'));
$record->setDummy('P');
return $invalidfields;
}

private function updateDateUpdatedIfUpdatedCostOrPrice(ItemXrefManufacturer $record) {
$modified = false;

$fields = ['price', 'cost'];

foreach ($fields as $alias) {
$field = strtolower(ItemXrefManufacturer::aliasproperty($alias));
if (array_key_exists($field, $record->originalvalues) && $record->originalvalues[$field] != $record->$field) {
$modified = true;
}
}
if ($modified === false) {
return false;
}
$record->setDateupdated(date('Ymd'));
return true;
}

/**
* Sets Record fields if valid, returns invalid fields
* @param ItemXrefManufacturer $record MXRFE record
Expand Down
Loading

0 comments on commit cb783aa

Please sign in to comment.