Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 - fix the update of the flight #73

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion card.php
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ function init_myfunc()
?>
</div>

<form class="flight-form js-form" name='add' action="card.php?rowid=<?php echo $object->getId(); ?>" method="POST">
<form class="flight-form js-form" name='add' action="card.php?id=<?php echo $object->getId(); ?>" method="POST">
<input type="hidden" name="action" value="update"/>
<input type="hidden" name="token" value="<?php echo newToken();?>"/>

Expand Down
19 changes: 13 additions & 6 deletions class/bbcvols.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,9 @@ public function fetch($id, $ref = null)


$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
if (null !== $ref) {
$sql .= ' WHERE t.idBBC_vols = ' . $id;
if (!empty($ref)) {
$sql .= ' WHERE t.ref = ' . '\'' . $ref . '\'';
} else {
$sql .= ' WHERE t.idBBC_vols = ' . $id;
}

$resql = $this->db->query($sql);
Expand Down Expand Up @@ -492,9 +491,9 @@ public function fetch($id, $ref = null)

if ($numrows) {
return 1;
} else {
return 0;
}

return 0;
}

$this->errors[] = 'Error ' . $this->db->lasterror();
Expand Down Expand Up @@ -1179,11 +1178,19 @@ public function isBilled()
*/
public function getDate()
{
if(empty($this->date)){
return new DateTime();
}

if(is_string($this->date)){
return DateTime::createFromFormat('Y-m-d', $this->date);
}

return (new DateTime())->setTimestamp($this->date);
}

/**
* @param string $date
* @param string|int $date
*
* @return Bbcvols
*/
Expand Down
6 changes: 4 additions & 2 deletions generateMonthlyBilling.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* When a user generates the expense report for all pilots
*/
define("EXPENSE_REPORT_GENERATOR_ACTION_GENERATE", "generate");
define("EXPENSE_REPORT_GENERATOR_ACTION_SELECT", "select");

/**
* When a user changes dates (year / Month)
Expand Down Expand Up @@ -118,6 +119,7 @@
<h2 class="section-title"><?php echo $langs->trans('Période'); ?></h2>

<form class="form-inline flight-form" method="POST">
<input type="hidden" name="token" value="<?php echo newToken(); ?>">
<section class="form-section">
<input type="hidden" name="action" value="<?php echo EXPENSE_REPORT_GENERATOR_ACTION_CHANGE_DATES ?>">

Expand Down Expand Up @@ -156,7 +158,7 @@
</div>

<form action="#" method="POST">

<input type="hidden" name="token" value="<?php echo newToken(); ?>">
<!-- action -->
<input type="hidden" name="action" value="<?php echo EXPENSE_REPORT_GENERATOR_ACTION_GENERATE ?>">
<input type="hidden" name="month" value="<?php echo $month ?>">
Expand Down Expand Up @@ -224,4 +226,4 @@
</div>
<!-- end bbc style -->
<?php
llxFooter();
llxFooter();
Loading