- Moved Database Changes from Migrations to dbupdate_3.2.php

- Changed Column statusgrund_kurzbz to statusgrund_id
This commit is contained in:
oesi
2017-02-06 20:24:23 +01:00
parent fb8b37fe59
commit d2298ae52a
6 changed files with 791 additions and 99 deletions
+59 -59
View File
@@ -16,7 +16,7 @@ class Statusgrund extends VileSci_Controller
{
$this->load->view("crm/statusgrund.php");
}
public function listStatus()
{
$status = $this->StatusModel->load();
@@ -24,14 +24,14 @@ class Statusgrund extends VileSci_Controller
{
show_error($status->retval);
}
$data = array (
"status" => $status->retval
);
$this->load->view("crm/statusList.php", $data);
}
public function listGrund($status_kurzbz)
{
$statusGrund = $this->StatusgrundModel->loadWhere(array("status_kurzbz" => $status_kurzbz));
@@ -39,61 +39,61 @@ class Statusgrund extends VileSci_Controller
{
show_error($statusGrund->retval);
}
$data = array (
"statusGrund" => $statusGrund->retval,
"status_kurzbz" => $status_kurzbz
);
$this->load->view("crm/statusGrundList.php", $data);
}
public function editGrund($statusgrund_kurzbz, $update = null)
public function editGrund($statusgrund_id, $update = null)
{
$statusGrund = $this->StatusgrundModel->load($statusgrund_kurzbz);
$statusGrund = $this->StatusgrundModel->load($statusgrund_id);
if ($statusGrund->error)
{
show_error($statusGrund->retval);
}
$sprache = $this->SpracheModel->loadWhere(array('content' => true));
if ($sprache->error)
{
show_error($sprache->retval);
}
$data = array (
"statusgrund" => $statusGrund->retval[0],
"sprache" => $sprache->retval,
"update" => $update
);
$this->load->view("crm/statusgrundEdit.php", $data);
}
public function editStatus($status_kurzbz, $update = null)
public function editStatus($status_id, $update = null)
{
$status = $this->StatusModel->load($status_kurzbz);
$status = $this->StatusModel->load($status_id);
if ($status->error)
{
show_error($status->retval);
}
$sprache = $this->SpracheModel->loadWhere(array('content' => true));
if ($sprache->error)
{
show_error($sprache->retval);
}
$data = array (
"status" => $status->retval[0],
"sprache" => $sprache->retval,
"update" => $update
);
$this->load->view("crm/statusEdit.php", $data);
}
public function newGrund($status_kurzbz)
{
$sprache = $this->SpracheModel->loadWhere(array('content' => true));
@@ -101,31 +101,31 @@ class Statusgrund extends VileSci_Controller
{
show_error($sprache->retval);
}
$data = array (
"status_kurzbz" => $status_kurzbz,
"sprache" => $sprache->retval
);
$this->load->view("crm/statusgrundNew.php", $data);
}
public function saveGrund()
{
$statusgrund_kurzbz = $this->input->post("statusgrund_kurzbz");
$statusgrund_id = $this->input->post("statusgrund_id");
$aktiv = $this->input->post("aktiv") != null && $this->input->post("aktiv") == "on" ? true : false;
$bezeichnung_mehrsprachig = $this->input->post("bezeichnung_mehrsprachig");
$beschreibung = $this->input->post("beschreibung");
for ($i = 0; $i < count($bezeichnung_mehrsprachig); $i++)
{
if ($i == 0) $tmp = "{";
if (trim($bezeichnung_mehrsprachig[$i]) == "")
{
$bezeichnung_mehrsprachig[$i] = "\"\"";
}
$bezeichnung_mehrsprachig[$i] = str_replace(",", "|", $bezeichnung_mehrsprachig[$i]);
if ($i < count($bezeichnung_mehrsprachig) - 1)
{
@@ -135,19 +135,19 @@ class Statusgrund extends VileSci_Controller
{
$tmp .= $bezeichnung_mehrsprachig[$i];
}
if ($i == count($bezeichnung_mehrsprachig) - 1) $bezeichnung_mehrsprachig = $tmp . "}";
}
for ($i = 0; $i < count($beschreibung); $i++)
{
if ($i == 0) $tmp = "{";
if (trim($beschreibung[$i]) == "")
{
$beschreibung[$i] = "\"\"";
}
$beschreibung[$i] = str_replace(",", "|", $beschreibung[$i]);
if ($i < count($beschreibung) - 1)
{
@@ -157,42 +157,42 @@ class Statusgrund extends VileSci_Controller
{
$tmp .= $beschreibung[$i];
}
if ($i == count($beschreibung) - 1) $beschreibung = $tmp . "}";
}
$data = array(
"aktiv" => $aktiv,
"bezeichnung_mehrsprachig" => $bezeichnung_mehrsprachig,
"beschreibung" => $beschreibung
);
$statusgrund = $this->StatusgrundModel->update($statusgrund_kurzbz, $data);
$statusgrund = $this->StatusgrundModel->update($statusgrund_id, $data);
if ($statusgrund->error)
{
show_error($statusgrund->retval);
}
redirect("/crm/Statusgrund/editGrund/" . $statusgrund_kurzbz . "/" . true);
redirect("/crm/Statusgrund/editGrund/" . $statusgrund_id . "/" . true);
}
public function insGrund()
{
$aktiv = $this->input->post("aktiv") != null && $this->input->post("aktiv") == "on" ? true : false;
$bezeichnung_mehrsprachig = $this->input->post("bezeichnung_mehrsprachig");
$beschreibung = $this->input->post("beschreibung");
$status_kurzbz = $this->input->post("status_kurzbz");
for ($i = 0; $i < count($bezeichnung_mehrsprachig); $i++)
{
if ($i == 0) $tmp = "{";
if (trim($bezeichnung_mehrsprachig[$i]) == "")
{
$bezeichnung_mehrsprachig[$i] = "\"\"";
}
$bezeichnung_mehrsprachig[$i] = str_replace(",", "|", $bezeichnung_mehrsprachig[$i]);
if ($i < count($bezeichnung_mehrsprachig) - 1)
{
@@ -202,19 +202,19 @@ class Statusgrund extends VileSci_Controller
{
$tmp .= $bezeichnung_mehrsprachig[$i];
}
if ($i == count($bezeichnung_mehrsprachig) - 1) $bezeichnung_mehrsprachig = $tmp . "}";
}
for ($i = 0; $i < count($beschreibung); $i++)
{
if ($i == 0) $tmp = "{";
if (trim($beschreibung[$i]) == "")
{
$beschreibung[$i] = "\"\"";
}
$beschreibung[$i] = str_replace(",", "|", $beschreibung[$i]);
if ($i < count($beschreibung) - 1)
{
@@ -224,43 +224,43 @@ class Statusgrund extends VileSci_Controller
{
$tmp .= $beschreibung[$i];
}
if ($i == count($beschreibung) - 1) $beschreibung = $tmp . "}";
}
$data = array(
"status_kurzbz" => $status_kurzbz,
"aktiv" => $aktiv,
"bezeichnung_mehrsprachig" => $bezeichnung_mehrsprachig,
"beschreibung" => $beschreibung
);
$statusgrund = $this->StatusgrundModel->insert($data);
if ($statusgrund->error)
{
show_error($statusgrund->retval);
}
redirect("/crm/Statusgrund/editGrund/" . $statusgrund->retval . "/" . true);
}
public function saveStatus()
{
$status_kurzbz = $this->input->post("status_kurzbz");
$anmerkung = $this->input->post("anmerkung");
$bezeichnung_mehrsprachig = $this->input->post("bezeichnung_mehrsprachig");
$beschreibung = $this->input->post("beschreibung");
for ($i = 0; $i < count($bezeichnung_mehrsprachig); $i++)
{
if ($i == 0) $tmp = "{";
if (trim($bezeichnung_mehrsprachig[$i]) == "")
{
$bezeichnung_mehrsprachig[$i] = "\"\"";
}
$bezeichnung_mehrsprachig[$i] = str_replace(",", "|", $bezeichnung_mehrsprachig[$i]);
if ($i < count($bezeichnung_mehrsprachig) - 1)
{
@@ -270,23 +270,23 @@ class Statusgrund extends VileSci_Controller
{
$tmp .= $bezeichnung_mehrsprachig[$i];
}
if ($i == count($bezeichnung_mehrsprachig) - 1) $bezeichnung_mehrsprachig = $tmp . "}";
}
$data = array(
"anmerkung" => $anmerkung,
"bezeichnung_mehrsprachig" => $bezeichnung_mehrsprachig,
"beschreibung" => $beschreibung
);
$status = $this->StatusModel->update($status_kurzbz, $data);
if ($status->error)
{
show_error($status->retval);
}
redirect("/crm/Statusgrund/editStatus/" . $status_kurzbz . "/" . true);
}
}
+1 -1
View File
@@ -9,6 +9,6 @@ class Statusgrund_model extends DB_Model
{
parent::__construct();
$this->dbTable = "public.tbl_status_grund";
$this->pk = "statusgrund_kurzbz";
$this->pk = "statusgrund_id";
}
}
+3 -3
View File
@@ -3,7 +3,7 @@
?>
<div class="row">
<div class="span4">
<a href="../newGrund/<?php echo $status_kurzbz; ?>" target="StatusgrundBottom">+ Neu Grund</a>
<a href="../newGrund/<?php echo $status_kurzbz; ?>" target="StatusgrundBottom">+ Neuen Statusgrund hinzufügen</a>
</div>
</div>
<div class="row">
@@ -21,11 +21,11 @@
<tbody>
<?php foreach ($statusGrund as $s): ?>
<tr>
<td><a href="../editGrund/<?php echo $s->statusgrund_kurzbz; ?>" target="StatusgrundBottom"><?php echo $s->status_kurzbz; ?></a></td>
<td><a href="../editGrund/<?php echo $s->statusgrund_id; ?>" target="StatusgrundBottom"><?php echo $s->status_kurzbz; ?></a></td>
<td><?php echo json_encode($s->aktiv); ?></td>
<td><?php echo json_encode($s->bezeichnung_mehrsprachig); ?></td>
<td><?php echo json_encode($s->beschreibung); ?></td>
<td><a href="../editGrund/<?php echo $s->statusgrund_kurzbz; ?>" target="StatusgrundBottom">Edit</a></td>
<td><a href="../editGrund/<?php echo $s->statusgrund_id; ?>" target="StatusgrundBottom">Edit</a></td>
</tr>
<?php endforeach ?>
</tbody>
+7 -7
View File
@@ -1,12 +1,12 @@
<?php
$this->load->view('templates/header', array('title' => 'StatusgrundEdit'));
$sg = $statusgrund;
?>
<div class="row">
<div class="span4">
<h2>Status grund: <?php echo $sg->status_kurzbz; ?></h2>
<h2>Statusgrund: <?php echo $sg->status_kurzbz; ?></h2>
<form method="post" action="<?php echo APP_ROOT . "index.ci.php/crm/Statusgrund/saveGrund";?>">
<table>
<tr>
@@ -31,7 +31,7 @@
?>
<input type="text" name="bezeichnung_mehrsprachig[]" value="<?php echo $val; ?>" /><br/>
<?php endforeach ?>
</td>
</tr>
<tr>
@@ -70,7 +70,7 @@
</tr>
<tr>
<td>
Aktiv:
Aktiv:
</td>
<td>
<input type="checkbox" name="aktiv" <?php echo isset($sg->aktiv) && $sg->aktiv === true ? "checked" : ""; ?> />
@@ -87,12 +87,12 @@
</td>
</tr>
</table>
<input type="hidden" name="statusgrund_kurzbz" value="<?php echo isset($sg->statusgrund_kurzbz) ? $sg->statusgrund_kurzbz : ""; ?>" />
<input type="hidden" name="statusgrund_id" value="<?php echo isset($sg->statusgrund_id) ? $sg->statusgrund_id : ""; ?>" />
</form>
</div>
</div>
</body>
<?php
if (!is_null($update))
{
@@ -103,5 +103,5 @@
<?php
}
?>
</html>
+7 -7
View File
@@ -1,21 +1,21 @@
<?php
$this->load->view('templates/header', array('title' => 'StatusgrundNew'));
$this->load->view('templates/header', array('title' => 'StatusgrundNew'));
?>
<div class="row">
<div class="span4">
<h2>New status grund</h2>
<h2>Neuer Statusgrund</h2>
<form method="post" action="<?php echo APP_ROOT . "index.ci.php/crm/Statusgrund/insGrund";?>">
<table>
<tr>
<td colspan="2">
Bezeichnung mehrsprachig:<br/><br/>
<?php foreach ($sprache as $s): ?>
<?php echo $s->sprache; ?>:<br/>
<input type="text" name="bezeichnung_mehrsprachig[]" value="" /><br/>
<?php endforeach ?>
</td>
</tr>
<tr>
@@ -26,7 +26,7 @@
<tr>
<td colspan="2">
Beschreibung:<br/><br/>
<?php foreach ($sprache as $s): ?>
<?php echo $s->sprache; ?>:<br/>
<textarea name="beschreibung[]"></textarea><br/>
@@ -40,7 +40,7 @@
</tr>
<tr>
<td>
Aktiv:
Aktiv:
</td>
<td>
<input type="checkbox" name="aktiv" />
@@ -62,5 +62,5 @@
</div>
</div>
</body>
</html>