More improvements e.g. flags and provision target
This commit is contained in:
+18
-3
@@ -63,6 +63,8 @@ switch ($submit = form_get_action()) {
|
||||
$p[':customerno'] = gpc_get_string($_POST, 'customerno', 20);
|
||||
$p[':contractno'] = gpc_get_string($_POST, 'contractno', 20);
|
||||
$p[':remarks'] = gpc_get_string($_POST, 'remarks', 150);
|
||||
$allowed = db_load_enum('company', 'flags');
|
||||
$p[':flags'] = gpc_get_set($_POST, 'flags', $allowed, true, NULL);
|
||||
db_exec_update('company', $p, 'compid');
|
||||
$action = ACT_VIEW;
|
||||
break;
|
||||
@@ -136,7 +138,7 @@ $page = gpc_get_int($_REQUEST, 'p', 1);
|
||||
$rows_pp = gpc_get_int($_REQUEST, 'n', $user->rows_pp);
|
||||
$lastpage = ceil($numrows/$rows_pp);
|
||||
|
||||
$sql = "SELECT compid, compname, comptype, remarks "
|
||||
$sql = "SELECT compid, compname, comptype, remarks, flags "
|
||||
. "FROM company";
|
||||
if ($where) $sql .= ' WHERE ' . $where;
|
||||
$sql .= $order;
|
||||
@@ -212,6 +214,14 @@ foreach ($res as $row) {
|
||||
echo "<tr>\n";
|
||||
echo '<td>', $i;
|
||||
echo '<a title="', _('View'), '" href="', $g_scriptname, '?f=view&id=', $row['compid'], '"><i class="bi bi-eye ms-2"></i></a>', "\n";
|
||||
// icons for some flags
|
||||
$flags = explode(',', $row['flags']);
|
||||
if (in_array('historic', $flags)) {
|
||||
echo '<i class="bi bi-h-square ms-2" title="', _('Historic company'), '"></i>';
|
||||
}
|
||||
if (in_array('deleted', $flags)) {
|
||||
echo '<i class="bi bi-recycle ms-2" title="', _('Deleted'), '"></i>';
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "<td>", $row['compname'], "</td>\n";
|
||||
echo "<td>", $opt_comptype[$row['comptype']], "</td>\n";
|
||||
@@ -251,7 +261,7 @@ elseif ($action == ACT_VIEW):
|
||||
// ========== VARIANT: view single record =====================================
|
||||
|
||||
$sql = "SELECT compname, comptype, comptype2, shortname, street, zip, city,"
|
||||
. " country, contact, phone, email, web, customerno, contractno, remarks "
|
||||
. " country, contact, phone, email, web, customerno, contractno, remarks, flags "
|
||||
. "FROM company "
|
||||
. "WHERE compid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -283,6 +293,7 @@ echo make_weblink($company->web), ' ', $company->web, "</td></tr>\n";
|
||||
echo '<tr><th scope="row">', _('Customer no.'),"</th><td>", $company->customerno, "</td></tr>\n";
|
||||
echo '<tr><th scope="row">', _('Contract no.'),"</th><td>", $company->contractno, "</td></tr>\n";
|
||||
echo '<tr><th scope="row">', _('Remarks'),"</th><td>", $company->remarks, "</td></tr>\n";
|
||||
echo '<tr><th scope="row">', _('Flags'),"</th><td>", $company->flags, "</td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
form_view_buttons($g_scriptname, $id);
|
||||
@@ -330,7 +341,7 @@ elseif ($action == ACT_EDIT):
|
||||
echo '<h2>', _('Edit Company'), "</h2>\n";
|
||||
|
||||
$sql = "SELECT compname, comptype, comptype2, street, zip, city, country,"
|
||||
. " contact, phone, email, web, customerno, contractno, remarks "
|
||||
. " contact, phone, email, web, customerno, contractno, remarks, flags "
|
||||
. "FROM company "
|
||||
. "WHERE compid=?";
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -409,6 +420,10 @@ form_create_select('comptype2', _('Secondary company type'), $g_opt_none + $opt_
|
||||
<label for="remarks" class="form-label"><?=_('Remarks')?></label>
|
||||
<textarea class="form-control" id="remarks" name="remarks" rows="3"><?=$company->remarks ?></textarea>
|
||||
</div>
|
||||
<?php
|
||||
$opt_flags = db_load_enum('company', 'flags', true, true, false);
|
||||
form_create_checks('flags', _('Flags'), $opt_flags, explode(',', $company->flags));
|
||||
?>
|
||||
<button type="submit" name="submit[update]" class="btn btn-primary"><?=_('Save')?></button>
|
||||
<a href="<?=$g_scriptname?>?f=view&id=<?=$id?>" class="btn btn-secondary"><?=_('Back')?></a>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user