Correction fausse manip (oups boulette)
This commit is contained in:
parent
1eb34b6499
commit
c87a281f2c
181
htdocs/soc.php
181
htdocs/soc.php
@ -27,15 +27,14 @@ require("pre.inc.php");
|
||||
$langs->load("soc");
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Sécurité accés client
|
||||
*/
|
||||
if ($user->societe_id > 0)
|
||||
{
|
||||
$_POST["action"] = '';
|
||||
$_GET["action"] = '';
|
||||
$socid = $user->societe_id;
|
||||
$_POST["action"] = '';
|
||||
$_GET["socid"] = $user->societe_id;
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'add' or $_POST["action"] == 'update')
|
||||
@ -60,6 +59,179 @@ if ($_POST["action"] == 'add' or $_POST["action"] == 'update')
|
||||
$soc->client = $_POST["client"];
|
||||
$soc->fournisseur = $_POST["fournisseur"];
|
||||
|
||||
if ($_POST["action"] == 'update')
|
||||
{
|
||||
$soc->update($socid);
|
||||
}
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
$socid = $soc->create();
|
||||
Header("Location: soc.php?socid=$socid");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
llxHeader();
|
||||
$form = new Form($db);
|
||||
|
||||
if ($_GET["action"] == 'create')
|
||||
{
|
||||
if ($user->rights->societe->creer) {
|
||||
/*
|
||||
* Fiche societe en mode création
|
||||
*/
|
||||
$soc = new Societe($db);
|
||||
if ($_GET["type"]=='f') { $soc->fournisseur=1; }
|
||||
if ($_GET["type"]=='c') { $soc->client=1; }
|
||||
if ($_GET["type"]=='p') { $soc->client=2; }
|
||||
|
||||
print '<div class="titre">'.$langs->trans("NewCompany").'</div><br>';
|
||||
print '<form action="soc.php" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="fournisseur" value="0">';
|
||||
|
||||
print '<table class="border" cellpadding="3" cellspacing="0" width="100%">';
|
||||
print '<tr><td>'.$langs->trans('Name').'</td><td colspan="3"><input type="text" name="nom"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Address').'</td><td colspan="3"><textarea name="adresse" cols="30" rows="3" wrap="soft"></textarea></td></tr>';
|
||||
print '<tr><td>'.$langs->trans('Zip').'</td><td><input size="6" type="text" name="cp"> ';
|
||||
print $langs->trans('Town').' <input type="text" name="ville"></td>';
|
||||
|
||||
print '<td>'.$langs->trans('State').'</td><td>';
|
||||
print $form->select_departement($soc->departement_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
||||
print $form->select_pays($soc->pays_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Phone').'</td><td><input type="text" name="tel"></td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3">http://<input size="40" type="text" name="url"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('ProfIdSiren').'</td><td><input type="text" name="siren"></td>';
|
||||
|
||||
print '<td>'.$langs->trans('ProfIdSiret').'</td><td><input type="text" name="siret" size="15" maxlength="14" value="'.$soc->siret.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Ape').'</td><td><input type="text" name="ape" size="5" maxlength="4" value="'.$soc->ape.'"></td>';
|
||||
print '<td>Capital</td><td><input type="text" name="capital" size="10" value="'.$soc->capital.'"> '.MAIN_MONNAIE.'</td></tr>';
|
||||
|
||||
print '<tr><td>Forme juridique</td><td colspan="3">';
|
||||
print $form->select_forme_juridique($soc->forme_juridique_code);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Effectif</td><td colspan="3">';
|
||||
print $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td colspan="2">'.$langs->trans('TVAIntra').'</td><td colspan="2">';
|
||||
|
||||
print '<input type="text" name="tva_intra_code" size="3" maxlength="2" value="'.$soc->tva_intra_code.'">';
|
||||
print '<input type="text" name="tva_intra_num" size="18" maxlength="18" value="'.$soc->tva_intra_num.'">';
|
||||
print '<br>Vous pouvez vérifier ce numéro sur le <a href="http://europa.eu.int/comm/taxation_customs/vies/fr/vieshome.htm" target="_blank">site</a> de la commission européenne';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('ProspectCustomer').'</td><td><select name="client">';
|
||||
print '<option value="2"'.($soc->client==2?' selected':'').'>'.$langs->trans('Prospect').'</option>';
|
||||
print '<option value="1"'.($soc->client==1?' selected':'').'>'.$langs->trans('Customer').'</option>';
|
||||
print '<option value="0"'.($soc->client==0?' selected':'').'>Ni client, ni prospect</option>';
|
||||
print '</select></td>';
|
||||
|
||||
print '<td>'.$langs->trans('Supplier').'</td><td><select name="fournisseur">';
|
||||
print_oui_non($soc->fournisseur);
|
||||
print '</select></td></tr>';
|
||||
|
||||
print '<tr><td colspan="4" align="center"><input type="submit" value="'.$langs->trans('Add').'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
}
|
||||
elseif ($_GET["action"] == 'edit')
|
||||
{
|
||||
/*
|
||||
* Fiche societe en mode edition
|
||||
*/
|
||||
|
||||
print_titre("Edition de la société");
|
||||
|
||||
if ($_GET["socid"])
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->id = $_GET["socid"];
|
||||
$soc->fetch($_GET["socid"]);
|
||||
|
||||
print '<form action="soc.php?socid='.$soc->id.'" method="post">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="border" width="100%" cellpadding="3" cellspacing="0">';
|
||||
print '<tr><td>Nom</td><td colspan="3"><input type="text" size="40" name="nom" value="'.$soc->nom.'"></td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans('Adresse').'</td><td colspan="3"><textarea name="adresse" cols="30" rows="3" wrap="soft">';
|
||||
print $soc->adresse;
|
||||
print '</textarea></td></tr>';
|
||||
|
||||
print '<tr><td>CP</td><td><input size="6" type="text" name="cp" value="'.$soc->cp.'"> ';
|
||||
print 'Ville <input type="text" name="ville" value="'.$soc->ville.'"></td>';
|
||||
print '<td>Département/Province/Canton</td><td>';
|
||||
print $form->select_departement($soc->departement_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Pays</td><td colspan="3">';
|
||||
print $form->select_pays($soc->pays_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans('Téléphone').'</td><td><input type="text" name="tel" value="'.$soc->tel.'"></td>';
|
||||
print '<td>'.$langs->trans('Fax').'</td><td><input type="text" name="fax" value="'.$soc->fax.'"></td></tr>';
|
||||
print '<tr><td>Web</td><td colspan="3">http://<input type="text" name="url" size="40" value="'.$soc->url.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Siren</td><td><input type="text" name="siren" size="10" maxlength="9" value="'.$soc->siren.'"></td>';
|
||||
print '<td>Siret</td><td><input type="text" name="siret" size="15" maxlength="14" value="'.$soc->siret.'"></td></tr>';
|
||||
|
||||
print '<tr><td>Ape</td><td><input type="text" name="ape" size="5" maxlength="4" value="'.$soc->ape.'"></td>';
|
||||
print '<td>Capital</td><td><input type="text" name="capital" size="10" value="'.$soc->capital.'"> '.MAIN_MONNAIE.'</td></tr>';
|
||||
|
||||
|
||||
print '<tr><td>Forme juridique</td><td colspan="3">';
|
||||
print $form->select_forme_juridique($soc->forme_juridique_code);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Effectif</td><td colspan="3">';
|
||||
print $form->select_array("effectif_id",$soc->effectif_array(), $soc->effectif_id);
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td colspan="2">Numéro de TVA Intracommunautaire</td><td colspan="2">';
|
||||
|
||||
print '<input type="text" name="tva_intra_code" size="3" maxlength="2" value="'.$soc->tva_intra_code.'">';
|
||||
print '<input type="text" name="tva_intra_num" size="18" maxlength="18" value="'.$soc->tva_intra_num.'">';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td>Prospect / Client</td><td><select name="client">';
|
||||
print '<option value="2"'.($soc->client==2?' selected':'').'>Prospect</option>';
|
||||
print '<option value="1"'.($soc->client==1?' selected':'').'>Client</option>';
|
||||
print '<option value="0"'.($soc->client==0?' selected':'').'>Ni client, ni prospect</option>';
|
||||
print '</select></td>';
|
||||
|
||||
print '<td>Fournisseur</td><td><select name="fournisseur">';
|
||||
print_oui_non($soc->fournisseur);
|
||||
print '</select>';
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td align="center" colspan="4"><input type="submit" value="Mettre à jour"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
print 'Astuce : Vous pouvez vérifier le numéro de TVA intra communautaire sur le <a href="http://europa.eu.int/comm/taxation_customs/vies/fr/vieshome.htm" target="_blank">site</a> de la commission européenne';
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$soc = new Societe($db);
|
||||
$soc->id = $_GET["socid"];
|
||||
$soc->fetch($_GET["socid"]);
|
||||
|
||||
$head[0][0] = 'soc.php?socid='.$soc->id;
|
||||
@ -143,7 +315,7 @@ if ($_POST["action"] == 'add' or $_POST["action"] == 'update')
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/soc.php?socid='.$soc->id.'&action=edit">Editer</a>';
|
||||
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/soc.php?socid='.$soc->id.'&action=edit">Editer</a>';
|
||||
|
||||
print '<a class="tabAction" href="'.DOL_URL_ROOT.'/contact/fiche.php?socid='.$soc->id.'&action=create">Ajouter un contact</a>';
|
||||
|
||||
@ -157,3 +329,4 @@ $db->close();
|
||||
|
||||
llxFooter("<em>Dernière modification $Date$ révision $Revision$</em>");
|
||||
?>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user