mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Firmenverwaltung - Zuordnung zu Mobilitaetsprogramm hinzugefuegt
This commit is contained in:
+75
-1
@@ -833,6 +833,80 @@ class firma extends basis_db
|
||||
}
|
||||
return $this->firma_organisationseinheit_id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Teilt einer Firma ein Mobilitaetsprogramm zu
|
||||
*
|
||||
* @param $firma_id
|
||||
* @param $mobilitaetsprogramm_code
|
||||
* @return boolean
|
||||
*/
|
||||
function addMobilitaetsprogramm($firma_id, $mobilitaetsprogramm_code)
|
||||
{
|
||||
if(!$this->existsMobilitaetsprogramm($firma_id, $mobilitaetsprogramm_code))
|
||||
{
|
||||
$qry = "INSERT INTO public.tbl_firma_mobilitaetsprogramm(firma_id, mobilitaetsprogramm_code) VALUES(".
|
||||
$this->db_add_param($firma_id, FHC_INTEGER).','.
|
||||
$this->db_add_param($mobilitaetsprogramm_code, FHC_INTEGER).');';
|
||||
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prueft ob eine Mobilitaetsprogrammzuordnung zu einer Firma existiert
|
||||
* @param $firma_id
|
||||
* @param $mobilitaetsprogramm_code
|
||||
* @return boolean
|
||||
*/
|
||||
function existsMobilitaetsprogramm($firma_id, $mobilitaetsprogramm_code)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
public.tbl_firma_mobilitaetsprogramm
|
||||
WHERE
|
||||
firma_id=".$this->db_add_param($firma_id, FHC_INTEGER)."
|
||||
AND mobilitaetsprogramm_code=".$this->db_add_param($mobilitaetsprogramm_code, FHC_INTEGER);
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
if($this->db_num_rows()>0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Laden der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Entfernt die Zuordnung zu einem Mobilitaetsprogramm
|
||||
* @param $firma_id
|
||||
* @param $mobilitaetsprogramm_code
|
||||
* @return boolean
|
||||
*/
|
||||
function deletemobilitaetsprogramm($firma_id, $mobilitaetsprogramm_code)
|
||||
{
|
||||
$qry = "DELETE FROM public.tbl_firma_mobilitaetsprogramm WHERE
|
||||
firma_id=".$this->db_add_param($firma_id, FHC_INTEGER)."
|
||||
AND mobilitaetsprogramm_code=".$this->db_add_param($mobilitaetsprogramm_code);
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Löschen der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -54,7 +54,7 @@ class mobilitaetsprogramm extends basis_db
|
||||
$mobility->mobilitaetsprogramm_code = $row->mobilitaetsprogramm_code;
|
||||
$mobility->kurzbz = $row->kurzbz;
|
||||
$mobility->beschreibung = $row->beschreibung;
|
||||
$mobility->sichtbar = $row->sichtbar;
|
||||
$mobility->sichtbar = $this->db_parse_bool($row->sichtbar);
|
||||
|
||||
$this->result[]=$mobility;
|
||||
}
|
||||
@@ -97,4 +97,41 @@ class mobilitaetsprogramm extends basis_db
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Laedt die Mobilitaetsprogramme die einer Firma zugeteilt sind
|
||||
* @param $firma_id
|
||||
* @return boolean
|
||||
*/
|
||||
public function getFirmaMobilitaetsprogramm($firma_id)
|
||||
{
|
||||
$qry = "SELECT
|
||||
*
|
||||
FROM
|
||||
bis.tbl_mobilitaetsprogramm
|
||||
JOIN public.tbl_firma_mobilitaetsprogramm USING(mobilitaetsprogramm_code)
|
||||
WHERE
|
||||
firma_id=".$this->db_add_param($firma_id, FHC_INTEGER);
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
while($row = $this->db_fetch_object())
|
||||
{
|
||||
$mobility = new mobilitaetsprogramm();
|
||||
|
||||
$mobility->mobilitaetsprogramm_code = $row->mobilitaetsprogramm_code;
|
||||
$mobility->kurzbz = $row->kurzbz;
|
||||
$mobility->beschreibung = $row->beschreibung;
|
||||
$mobility->sichtbar = $this->db_parse_bool($row->sichtbar);
|
||||
$mobility->sichtbar_outgoing = $this->db_parse_bool($row->sichtbar_outgoing);
|
||||
|
||||
$this->result[]=$mobility;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = "Fehler bei der Abfrage aufgetreten";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ require_once('../../include/standort.class.php');
|
||||
require_once('../../include/adresse.class.php');
|
||||
require_once('../../include/nation.class.php');
|
||||
require_once('../../include/benutzerberechtigung.class.php');
|
||||
require_once('../../include/mobilitaetsprogramm.class.php');
|
||||
|
||||
if (!$db = new basis_db())
|
||||
die('Es konnte keine Verbindung zum Server aufgebaut werden.');
|
||||
@@ -47,7 +48,7 @@ $standort_id = (isset($_REQUEST['standort_id'])?$_REQUEST['standort_id']:'');
|
||||
$oe_kurzbz = (isset($_REQUEST['oe_kurzbz'])?$_REQUEST['oe_kurzbz']:'');
|
||||
$firma_organisationseinheit_id = (isset($_REQUEST['firma_organisationseinheit_id'])?$_REQUEST['firma_organisationseinheit_id']:'');
|
||||
$tag = (isset($_REQUEST['tag'])?$_REQUEST['tag']:'');
|
||||
|
||||
$mobilitaetsprogramm_code = (isset($_REQUEST['mobilitaetsprogramm_code'])?$_REQUEST['mobilitaetsprogramm_code']:'');
|
||||
$save = (isset($_REQUEST['save'])?$_REQUEST['save']:null);
|
||||
$work = (isset($_REQUEST['work'])?$_REQUEST['work']:(isset($_REQUEST['save'])?$_REQUEST['save']:null));
|
||||
$ajax = (isset($_REQUEST['ajax'])?$_REQUEST['ajax']:null);
|
||||
@@ -103,6 +104,23 @@ if(isset($_GET['deleteorganisationseinheit']))
|
||||
$tabselect=1;
|
||||
}
|
||||
|
||||
if(isset($_GET['deletemobilitaetsprogramm']))
|
||||
{
|
||||
if(!$rechte->isBerechtigt('basis/firma:begrenzt',null, 'suid'))
|
||||
die('Sie haben keine Berechtigung fuer diese Aktion');
|
||||
if(!empty($mobilitaetsprogramm_code))
|
||||
{
|
||||
$firma = new firma();
|
||||
if(!$firma->deletemobilitaetsprogramm($firma_id, $mobilitaetsprogramm_code))
|
||||
{
|
||||
$errorstr=($errorstr?$errorstr.', ':'').'Fehler beim Loeschen Firma/Mobilitaetsprogramm:'.$firma->errormsg;
|
||||
}
|
||||
}
|
||||
else
|
||||
$errorstr=($errorstr?$errorstr.', ':'').'Fehler beim Loeschen Firma/Mobilitaetsprogramm : Code fehlt';
|
||||
$tabselect=2;
|
||||
}
|
||||
|
||||
//Loeschen eines Tags
|
||||
if(isset($_GET['deletetag']))
|
||||
{
|
||||
@@ -161,6 +179,14 @@ switch ($work)
|
||||
echo getOrganisationsliste($firma_id,$adresstyp_arr,$user);
|
||||
break;
|
||||
|
||||
case 'mobilitaetsprogramm':
|
||||
echo getMobilitaetsprogrammliste($firma_id,$user);
|
||||
break;
|
||||
case 'saveMobilitaetsprogramm':
|
||||
saveMobilitaetsprogramm($firma_id, $mobilitaetsprogramm_code);
|
||||
echo getFirmadetail($firma_id,$adresstyp_arr,$user,$neu);
|
||||
$tabselect=2;
|
||||
break;
|
||||
case 'anmerkungsfeld':
|
||||
echo getAnmerkungen($firma_id,$user);
|
||||
break;
|
||||
@@ -168,9 +194,9 @@ switch ($work)
|
||||
$status = saveAnmerkungen($firma_id,$user, $rechte);
|
||||
echo getFirmadetail($firma_id,$adresstyp_arr,$user,$neu);
|
||||
echo $status;
|
||||
$tabselect=2;
|
||||
$tabselect=3;
|
||||
break;
|
||||
|
||||
|
||||
case 'saveFirma':
|
||||
$status=saveFirma($user,$rechte); // Postdaten werden in der Funktion verarbeitet
|
||||
if (is_numeric($status))
|
||||
@@ -256,7 +282,7 @@ function getFirmadetail($firma_id, $adresstyp_arr, $user, $neu)
|
||||
$htmlstr.="</tr>\n";
|
||||
$htmlstr.="<tr><td><table><tr>\n";
|
||||
$htmlstr.="<td>Steuernummer: </td>";
|
||||
$htmlstr.="<td><input size='32' maxlength='32' type='text' name='steuernummer' value=".$firma->steuernummer."></td>\n";
|
||||
$htmlstr.="<td><input size='32' maxlength='32' type='text' name='steuernummer' value='".$firma->steuernummer."'></td>\n";
|
||||
$htmlstr.="<td> </td>";
|
||||
$htmlstr.="<td>Finanzamt: </td>";
|
||||
// Finanzamt anzeige und suche
|
||||
@@ -332,6 +358,7 @@ function getFirmadetail($firma_id, $adresstyp_arr, $user, $neu)
|
||||
<ul class="css-tabs">
|
||||
<li><a href="#standort">Standorte</a></li>
|
||||
<li><a href="#organisationseinheit">Organisationseinheit</a></li>
|
||||
<li><a href="#mobilitaetsprogramm">Mobilitätsprogramm</a></li>
|
||||
<li><a href="#anmerkung">Anmerkungen</a></li>
|
||||
</ul>
|
||||
<div id="standort">
|
||||
@@ -340,6 +367,9 @@ function getFirmadetail($firma_id, $adresstyp_arr, $user, $neu)
|
||||
<div id="organisationseinheit">
|
||||
'.getOrganisationsliste($firma_id, $adresstyp_arr, $user).'
|
||||
</div>
|
||||
<div id="mobilitaetsprogramm">
|
||||
'.getMobilitaetsprogrammliste($firma_id, $user).'
|
||||
</div>
|
||||
<div id="anmerkung">
|
||||
'.getAnmerkungen($firma_id, $user).'
|
||||
</div>
|
||||
@@ -569,6 +599,65 @@ function getOrganisationsliste($firma_id,$adresstyp_arr,$user)
|
||||
return $htmlstr;
|
||||
}
|
||||
// ----------------------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Mobilitaetsprogrammliste
|
||||
*/
|
||||
function getMobilitaetsprogrammliste($firma_id,$user)
|
||||
{
|
||||
// Init
|
||||
$htmlstr='';
|
||||
// Plausib
|
||||
if (empty($firma_id) || !is_numeric($firma_id) )
|
||||
return 'Firma fehlt.';
|
||||
|
||||
$htmlstr.= '<table class="liste">
|
||||
<tr>
|
||||
<th width="45%">Mobilitätsprogramm</th>
|
||||
<th width="5%"></th>
|
||||
<td width="15%" align="center" valign="top" colspan="2">
|
||||
|
||||
<form action="'.$_SERVER['PHP_SELF'].'?firma_id='.$firma_id.'&work=saveMobilitaetsprogramm" METHOD="POST">
|
||||
<SELECT name="mobilitaetsprogramm_code">';
|
||||
$mob = new mobilitaetsprogramm();
|
||||
$mob->getAll();
|
||||
|
||||
foreach($mob->result as $row)
|
||||
{
|
||||
$htmlstr.= '<OPTION value="'.$mob->convert_html_chars($row->mobilitaetsprogramm_code).'">'.$mob->convert_html_chars($row->kurzbz).'</OPTION>';
|
||||
}
|
||||
$htmlstr.='
|
||||
</SELECT>
|
||||
<input type="submit" value="Hinzufügen">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
';
|
||||
|
||||
// Datenlesen zur Firma
|
||||
$mob = new mobilitaetsprogramm();
|
||||
if (!$mob->getFirmaMobilitaetsprogramm($firma_id))
|
||||
return $htmlstr.'</table>';
|
||||
$i=0;
|
||||
foreach ($mob->result as $row)
|
||||
{
|
||||
$htmlstr .= "<tr class='liste". ($i%2) ."'>\n";
|
||||
$htmlstr.= '<td>'.$row->kurzbz.'</td>';
|
||||
$htmlstr.= "<td align='center'><a href='".$_SERVER['PHP_SELF']."?deletemobilitaetsprogramm=true&firma_id=".$firma_id."&mobilitaetsprogramm_code=".$row->mobilitaetsprogramm_code."' onclick='return confdel()'><img src='../../skin/images/application_form_delete.png' alt='loeschen' title='loeschen'/></a></td>";
|
||||
$htmlstr.= '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
$htmlstr.= '</table>';
|
||||
return $htmlstr;
|
||||
}
|
||||
// ----------------------------------------------------------------------------------------------------------------------------------
|
||||
function saveMobilitaetsprogramm($firma_id, $mobilitaetsprogramm_code)
|
||||
{
|
||||
$firma = new firma();
|
||||
if($firma->addMobilitaetsprogramm($firma_id, $mobilitaetsprogramm_code))
|
||||
return true;
|
||||
}
|
||||
// ----------------------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* Anmerkungen
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user