forked from Wavyzz/dolibarr
Works on canvas integration in third party module
This commit is contained in:
@@ -98,6 +98,8 @@ class Canvas
|
|||||||
*/
|
*/
|
||||||
function fetch($id,$action='')
|
function fetch($id,$action='')
|
||||||
{
|
{
|
||||||
|
$this->action = $action;
|
||||||
|
|
||||||
$ret = $this->object->fetch($id,$action);
|
$ret = $this->object->fetch($id,$action);
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3209,9 +3209,10 @@ function monthArrayOrSelected($selected=0)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Returns formated reduction
|
* Returns formated errors messages
|
||||||
* \param reduction Reduction percentage
|
* @param mesgstring Error message
|
||||||
* \return int Return number of error messages shown
|
* @param mesgarray Error messages array
|
||||||
|
* @return html Return html output
|
||||||
*/
|
*/
|
||||||
function dol_htmloutput_errors($mesgstring='',$mesgarray='')
|
function dol_htmloutput_errors($mesgstring='',$mesgarray='')
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class ThirdPartyDefault extends Societe
|
|||||||
$this->tpl['profid3'] = $this->ape;
|
$this->tpl['profid3'] = $this->ape;
|
||||||
$this->tpl['profid4'] = $this->idprof4;
|
$this->tpl['profid4'] = $this->idprof4;
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create' || $action == 'edit')
|
||||||
{
|
{
|
||||||
for ($i=1; $i<=4; $i++)
|
for ($i=1; $i<=4; $i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||||
<input type="hidden" name="cleartype" value="0">
|
<input type="hidden" name="cleartype" value="0">
|
||||||
<input type="hidden" name="private" value="<?php echo $this->object->tpl['particulier']; ?>">
|
<input type="hidden" name="private" value="<?php echo $this->object->tpl['particulier']; ?>">
|
||||||
<?php if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) { ?>
|
<?php if ($this->object->tpl['auto_customercode'] || $this->object->tpl['auto_suppliercode']) { ?>
|
||||||
<input type="hidden" name="code_auto" value="1">
|
<input type="hidden" name="code_auto" value="1">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
|||||||
@@ -21,5 +21,193 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
|
<form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->object->tpl['id']; ?>" method="POST" name="formsoc">
|
||||||
|
<input type="hidden" name="action" value="update">
|
||||||
|
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||||
|
<input type="hidden" name="socid" value="<?php echo $this->object->tpl['id']; ?>">
|
||||||
|
<?php if ($this->object->tpl['auto_customercode'] || $this->object->tpl['auto_suppliercode']) { ?>
|
||||||
|
<input type="hidden" name="code_auto" value="1">
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<table class="border" width="100%">
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><span class="fieldrequired"><?php echo $langs->trans('Name'); ?></span></td>
|
||||||
|
<td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="<?php echo $this->object->tpl['nom']; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans("Prefix"); ?></td>
|
||||||
|
<td colspan="3">
|
||||||
|
<?php if (($this->tpl['prefix_customercode'] || $this->tpl['prefix_suppliercode']) && $this->object->tpl['prefix_comm']) { ?>
|
||||||
|
<input type="hidden" name="prefix_comm" value="<?php echo $this->object->tpl['prefix_comm']; ?>">
|
||||||
|
<?php echo $this->object->tpl['prefix_comm']; ?>
|
||||||
|
<?php } else { ?>
|
||||||
|
<input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->object->tpl['prefix_comm']; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td width="25%"><span class="fieldrequired"><?php echo $langs->trans('ProspectCustomer'); ?></span></td>
|
||||||
|
<td width="25%"><?php echo $this->object->tpl['select_customertype']; ?></td>
|
||||||
|
<td width="25%"><?php echo $langs->trans('CustomerCode'); ?></td>
|
||||||
|
<td width="25%">
|
||||||
|
<table class="nobordernopadding">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?php if ($this->object->tpl['ismodifiable_customercode']) { ?>
|
||||||
|
<input type="text" name="code_client" size="16" value="<?php echo $this->object->tpl['customercode']; ?>" maxlength="15">
|
||||||
|
<?php } else { ?>
|
||||||
|
<?php echo $this->object->tpl['customercode']; ?>
|
||||||
|
<input type="hidden" name="code_client" value="<?php echo $this->object->tpl['customercode']; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $this->tpl['help_customercode']; ?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><span class="fieldrequired"><?php echo $langs->trans('Supplier'); ?></span></td>
|
||||||
|
<td><?php echo $this->object->tpl['yn_supplier']; ?></td>
|
||||||
|
<td><?php echo $langs->trans('SupplierCode'); ?></td>
|
||||||
|
<td>
|
||||||
|
<table class="nobordernopadding">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?php if ($this->object->tpl['ismodifiable_suppliercode']) { ?>
|
||||||
|
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->object->tpl['suppliercode']; ?>" maxlength="15">
|
||||||
|
<?php } else { ?>
|
||||||
|
<?php echo $this->object->tpl['suppliercode']; ?>
|
||||||
|
<input type="hidden" name="code_fournisseur" value="<?php echo $this->object->tpl['suppliercode']; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $this->tpl['help_suppliercode']; ?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ($this->object->tpl['fournisseur']) {
|
||||||
|
if (sizeof($this->object->tpl['suppliercategory']) > 0) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('SupplierCategory'); ?></td>
|
||||||
|
<td colspan="3"><?php echo $this->object->tpl['select_suppliercategory']; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } }?>
|
||||||
|
|
||||||
|
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('Gencod'); ?></td>
|
||||||
|
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->object->tpl['gencod']; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td valign="top"><?php echo $langs->trans('Address'); ?></td>
|
||||||
|
<td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft"><?php echo $this->object->tpl['address']; ?></textarea></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('Zip'); ?></td>
|
||||||
|
<td><input size="6" type="text" name="cp" value="<?php echo $this->object->tpl['cp']; ?>"><?php echo $this->object->tpl['autofilltownfromzip']; ?></td>
|
||||||
|
<td><?php echo $langs->trans('Town'); ?></td>
|
||||||
|
<td><input type="text" name="ville" value="<?php echo $this->object->tpl['ville']; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td width="25%"><?php echo $langs->trans('Country'); ?></td>
|
||||||
|
<td colspan="3"><?php echo $this->object->tpl['select_country']; echo $this->object->tpl['info_admin']; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('State'); ?></td>
|
||||||
|
<td colspan="3"><?php echo $this->object->tpl['select_state']; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('Phone'); ?></td>
|
||||||
|
<td><input type="text" name="tel" value="<?php echo $this->object->tpl['tel']; ?>"></td>
|
||||||
|
<td><?php echo $langs->trans('Fax'); ?></td>
|
||||||
|
<td><input type="text" name="fax" value="<?php echo $this->object->tpl['fax']; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?></td>
|
||||||
|
<td><input type="text" name="email" size="32" value="<?php echo $this->object->tpl['email']; ?>"></td>
|
||||||
|
<td><?php echo $langs->trans('Web'); ?></td>
|
||||||
|
<td><input type="text" name="url" size="32" value="<?php echo $this->object->tpl['url']; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('Capital'); ?></td>
|
||||||
|
<td colspan="3"><input type="text" name="capital" size="10" value="<?php echo $this->object->tpl['capital']; ?>"> <?php echo $langs->trans("Currency".$conf->monnaie); ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
for ($i=1; $i<=4; $i++) {
|
||||||
|
if ($this->object->tpl['langprofid'.$i]!='-') {
|
||||||
|
if ($i==1 || $i==3) echo '<tr>';
|
||||||
|
echo '<td>'.$this->object->tpl['langprofid'.$i].'</td>';
|
||||||
|
echo '<td>'.$this->object->tpl['showprofid'.$i].'</td>';
|
||||||
|
if ($i==2 || $i==4) echo '</tr>';
|
||||||
|
} else {
|
||||||
|
if ($i==1 || $i==3) echo '<tr>';
|
||||||
|
echo '<td> </td>';
|
||||||
|
echo '<td> </td>';
|
||||||
|
if ($i==2 || $i==4) echo '</tr>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('JuridicalStatus'); ?></td>
|
||||||
|
<td colspan="3"><?php echo $this->object->tpl['select_juridicalstatus']; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans("Type"); ?></td>
|
||||||
|
<td><?php echo $this->object->tpl['select_companytype']; echo $this->object->tpl['info_admin']; ?></td>
|
||||||
|
<td><?php echo $langs->trans("Staff"); ?></td>
|
||||||
|
<td><?php echo $this->object->tpl['select_workforce']; echo $this->object->tpl['info_admin']; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php if ($conf->global->MAIN_MULTILANGS) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans("DefaultLang"); ?></td>
|
||||||
|
<td colspan="3"><?php echo $this->object->tpl['select_lang']; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if ($conf->use_javascript_ajax) { ?>
|
||||||
|
<script language="JavaScript" type="text/javascript">
|
||||||
|
function CheckVAT(a) {
|
||||||
|
newpopup('<?php echo DOL_URL_ROOT; ?>/societe/checkvat/checkVatPopup.php?vatNumber='+a,'<?php echo dol_escape_js($langs->trans("VATIntraCheckableOnEUSite")); ?>',500,260);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
|
||||||
|
<td><?php echo $this->object->tpl['yn_assujtva']; ?></td>
|
||||||
|
<td nowrap="nowrap"><?php echo $langs->trans('VATIntra'); ?></td>
|
||||||
|
<td nowrap="nowrap"><?php echo $this->object->tpl['tva_intra']; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php if(!empty($this->object->tpl['localtax'])) echo $this->object->tpl['localtax']; ?>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<center>
|
||||||
|
<input type="submit" class="button" name="save" value="<?php echo $langs->trans("Save"); ?>">
|
||||||
|
|
||||||
|
<input type="submit" class="button" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
|
||||||
|
</center>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
<!-- END PHP TEMPLATE -->
|
<!-- END PHP TEMPLATE -->
|
||||||
@@ -39,11 +39,10 @@ class ThirdPartyIndividual extends Societe
|
|||||||
* \param DB Handler acces base de donnees
|
* \param DB Handler acces base de donnees
|
||||||
* \param id Id produit (0 par defaut)
|
* \param id Id produit (0 par defaut)
|
||||||
*/
|
*/
|
||||||
function ThirdPartyIndividual($DB=0, $id=0, $user=0)
|
function ThirdPartyIndividual($DB)
|
||||||
{
|
{
|
||||||
$this->db = $DB;
|
$this->db = $DB;
|
||||||
$this->id = $id ;
|
|
||||||
$this->user = $user;
|
|
||||||
$this->smarty = 0;
|
$this->smarty = 0;
|
||||||
$this->module = "societe";
|
$this->module = "societe";
|
||||||
$this->canvas = "individual";
|
$this->canvas = "individual";
|
||||||
@@ -60,10 +59,11 @@ class ThirdPartyIndividual extends Societe
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Lecture des donnees dans la base
|
* Lecture des donnees dans la base
|
||||||
* \param id Product id
|
* @param id Element id
|
||||||
|
* @param action Type of action
|
||||||
*/
|
*/
|
||||||
function fetch($id='', $ref='', $action='')
|
function fetch($id='', $action='')
|
||||||
{
|
{
|
||||||
$result = parent::fetch($id);
|
$result = parent::fetch($id);
|
||||||
|
|
||||||
@@ -81,9 +81,7 @@ class ThirdPartyIndividual extends Societe
|
|||||||
|
|
||||||
parent::assign_values($action);
|
parent::assign_values($action);
|
||||||
|
|
||||||
$form = new Form($db);
|
if ($action == 'create' || $action == 'edit')
|
||||||
|
|
||||||
if ($action == 'create')
|
|
||||||
{
|
{
|
||||||
$this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id);
|
$this->tpl['select_civility'] = $formcompany->select_civility($contact->civilite_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,5 +21,151 @@
|
|||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE -->
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
|
<form action="<?php echo $_SERVER["PHP_SELF"].'?socid='.$this->object->tpl['id']; ?>" method="POST" name="formsoc">
|
||||||
|
<input type="hidden" name="action" value="update">
|
||||||
|
<input type="hidden" name="token" value="<?php echo $_SESSION['newtoken']; ?>">
|
||||||
|
<input type="hidden" name="socid" value="<?php echo $this->object->tpl['id']; ?>">
|
||||||
|
<input type="hidden" name="typent_id" value="<?php echo $this->object->tpl['typent_id']; ?>">
|
||||||
|
<?php if ($this->object->tpl['auto_customercode'] || $this->object->tpl['auto_suppliercode']) { ?>
|
||||||
|
<input type="hidden" name="code_auto" value="1">
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<table class="border" width="100%">
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><span class="fieldrequired"><?php echo $langs->trans('Name'); ?></span></td>
|
||||||
|
<td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="<?php echo $this->object->tpl['nom']; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans("Prefix"); ?></td>
|
||||||
|
<td colspan="3">
|
||||||
|
<?php if (($this->tpl['prefix_customercode'] || $this->tpl['prefix_suppliercode']) && $this->object->tpl['prefix_comm']) { ?>
|
||||||
|
<input type="hidden" name="prefix_comm" value="<?php echo $this->object->tpl['prefix_comm']; ?>">
|
||||||
|
<?php echo $this->object->tpl['prefix_comm']; ?>
|
||||||
|
<?php } else { ?>
|
||||||
|
<input type="text" size="5" maxlength="5" name="prefix_comm" value="<?php echo $this->object->tpl['prefix_comm']; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td width="25%"><span class="fieldrequired"><?php echo $langs->trans('ProspectCustomer'); ?></span></td>
|
||||||
|
<td width="25%"><?php echo $this->object->tpl['select_customertype']; ?></td>
|
||||||
|
<td width="25%"><?php echo $langs->trans('CustomerCode'); ?></td>
|
||||||
|
<td width="25%">
|
||||||
|
<table class="nobordernopadding">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?php if ($this->object->tpl['ismodifiable_customercode']) { ?>
|
||||||
|
<input type="text" name="code_client" size="16" value="<?php echo $this->object->tpl['customercode']; ?>" maxlength="15">
|
||||||
|
<?php } else { ?>
|
||||||
|
<?php echo $this->object->tpl['customercode']; ?>
|
||||||
|
<input type="hidden" name="code_client" value="<?php echo $this->object->tpl['customercode']; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $this->tpl['help_customercode']; ?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><span class="fieldrequired"><?php echo $langs->trans('Supplier'); ?></span></td>
|
||||||
|
<td><?php echo $this->object->tpl['yn_supplier']; ?></td>
|
||||||
|
<td><?php echo $langs->trans('SupplierCode'); ?></td>
|
||||||
|
<td>
|
||||||
|
<table class="nobordernopadding">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<?php if ($this->object->tpl['ismodifiable_suppliercode']) { ?>
|
||||||
|
<input type="text" name="code_fournisseur" size="16" value="<?php echo $this->object->tpl['suppliercode']; ?>" maxlength="15">
|
||||||
|
<?php } else { ?>
|
||||||
|
<?php echo $this->object->tpl['suppliercode']; ?>
|
||||||
|
<input type="hidden" name="code_fournisseur" value="<?php echo $this->object->tpl['suppliercode']; ?>">
|
||||||
|
<?php } ?>
|
||||||
|
</td>
|
||||||
|
<td><?php echo $this->tpl['help_suppliercode']; ?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if ($this->object->tpl['fournisseur']) {
|
||||||
|
if (sizeof($this->object->tpl['suppliercategory']) > 0) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('SupplierCategory'); ?></td>
|
||||||
|
<td colspan="3"><?php echo $this->object->tpl['select_suppliercategory']; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } }?>
|
||||||
|
|
||||||
|
<?php if ($conf->global->MAIN_MODULE_BARCODE) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('Gencod'); ?></td>
|
||||||
|
<td colspan="3"><input type="text" name="gencod" value="<?php echo $this->object->tpl['gencod']; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td valign="top"><?php echo $langs->trans('Address'); ?></td>
|
||||||
|
<td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft"><?php echo $this->object->tpl['address']; ?></textarea></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('Zip'); ?></td>
|
||||||
|
<td><input size="6" type="text" name="cp" value="<?php echo $this->object->tpl['cp']; ?>"><?php echo $this->object->tpl['autofilltownfromzip']; ?></td>
|
||||||
|
<td><?php echo $langs->trans('Town'); ?></td>
|
||||||
|
<td><input type="text" name="ville" value="<?php echo $this->object->tpl['ville']; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td width="25%"><?php echo $langs->trans('Country'); ?></td>
|
||||||
|
<td colspan="3"><?php echo $this->object->tpl['select_country']; echo $this->object->tpl['info_admin']; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('State'); ?></td>
|
||||||
|
<td colspan="3"><?php echo $this->object->tpl['select_state']; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('Phone'); ?></td>
|
||||||
|
<td><input type="text" name="tel" value="<?php echo $this->object->tpl['tel']; ?>"></td>
|
||||||
|
<td><?php echo $langs->trans('Fax'); ?></td>
|
||||||
|
<td><input type="text" name="fax" value="<?php echo $this->object->tpl['fax']; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':''); ?></td>
|
||||||
|
<td><input type="text" name="email" size="32" value="<?php echo $this->object->tpl['email']; ?>"></td>
|
||||||
|
<td><?php echo $langs->trans('Web'); ?></td>
|
||||||
|
<td><input type="text" name="url" size="32" value="<?php echo $this->object->tpl['url']; ?>"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php if ($conf->global->MAIN_MULTILANGS) { ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans("DefaultLang"); ?></td>
|
||||||
|
<td colspan="3"><?php echo $this->object->tpl['select_lang']; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $langs->trans('VATIsUsed'); ?></td>
|
||||||
|
<td colspan="3"><?php echo $this->object->tpl['yn_assujtva']; ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<?php if(!empty($this->object->tpl['localtax'])) echo $this->object->tpl['localtax']; ?>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<center>
|
||||||
|
<input type="submit" class="button" name="save" value="<?php echo $langs->trans("Save"); ?>">
|
||||||
|
|
||||||
|
<input type="submit" class="button" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>">
|
||||||
|
</center>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
<!-- END PHP TEMPLATE -->
|
<!-- END PHP TEMPLATE -->
|
||||||
@@ -2160,9 +2160,15 @@ class Societe extends CommonObject
|
|||||||
$this->tpl[$key] = $value;
|
$this->tpl[$key] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'create')
|
if ($action == 'create' || $action == 'edit')
|
||||||
{
|
{
|
||||||
// Load object modCodeTiers
|
if ($_GET["type"]=='f') { $this->fournisseur=1; }
|
||||||
|
if ($_GET["type"]=='c') { $this->client=1; }
|
||||||
|
if ($_GET["type"]=='p') { $this->client=2; }
|
||||||
|
if ($_GET["type"]=='cp') { $this->client=3; }
|
||||||
|
if ($_REQUEST["private"]==1) { $this->particulier=1; }
|
||||||
|
|
||||||
|
// Load object modCodeClient
|
||||||
$module=$conf->global->SOCIETE_CODECLIENT_ADDON;
|
$module=$conf->global->SOCIETE_CODECLIENT_ADDON;
|
||||||
if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined"));
|
if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined"));
|
||||||
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
|
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
|
||||||
@@ -2171,6 +2177,11 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
|
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
|
||||||
$modCodeClient = new $module;
|
$modCodeClient = new $module;
|
||||||
|
$this->tpl['auto_customercode'] = $modCodeClient->code_auto;
|
||||||
|
// We verified if the tag prefix is used
|
||||||
|
if ($modCodeClient->code_auto) $this->tpl['prefix_customercode'] = $modCodeClient->verif_prefixIsUsed();
|
||||||
|
|
||||||
|
// Load object modCodeFournisseur
|
||||||
$module=$conf->global->SOCIETE_CODEFOURNISSEUR_ADDON;
|
$module=$conf->global->SOCIETE_CODEFOURNISSEUR_ADDON;
|
||||||
if (! $module) $module=$conf->global->SOCIETE_CODECLIENT_ADDON;
|
if (! $module) $module=$conf->global->SOCIETE_CODECLIENT_ADDON;
|
||||||
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
|
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
|
||||||
@@ -2179,6 +2190,9 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
|
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
|
||||||
$modCodeFournisseur = new $module;
|
$modCodeFournisseur = new $module;
|
||||||
|
$this->tpl['auto_suppliercode'] = $modCodeFournisseur->code_auto;
|
||||||
|
// We verified if the tag prefix is used
|
||||||
|
if ($modCodeFournisseur->code_auto) $this->tpl['prefix_suppliercode'] = $modCodeFournisseur->verif_prefixIsUsed();
|
||||||
|
|
||||||
// TODO create a function
|
// TODO create a function
|
||||||
$this->tpl['select_customertype'] = '<select class="flat" name="client">';
|
$this->tpl['select_customertype'] = '<select class="flat" name="client">';
|
||||||
@@ -2190,16 +2204,19 @@ class Societe extends CommonObject
|
|||||||
|
|
||||||
// Customer
|
// Customer
|
||||||
$this->tpl['customercode'] = $this->code_client;
|
$this->tpl['customercode'] = $this->code_client;
|
||||||
if ($modCodeClient->code_auto) $this->tpl['customercode'] = $modCodeClient->getNextValue($this,0);
|
if ((!$this->code_client || $this->code_client == -1) && $modCodeClient->code_auto) $this->tpl['customercode'] = $modCodeClient->getNextValue($this,0);
|
||||||
|
$this->tpl['ismodifiable_customercode'] = $this->codeclient_modifiable();
|
||||||
$s=$modCodeClient->getToolTip($langs,$this,0);
|
$s=$modCodeClient->getToolTip($langs,$this,0);
|
||||||
$this->tpl['help_customercode'] = $form->textwithpicto('',$s,1);
|
$this->tpl['help_customercode'] = $form->textwithpicto('',$s,1);
|
||||||
|
|
||||||
// Supplier
|
// Supplier
|
||||||
$this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->fournisseur,1);
|
$this->tpl['yn_supplier'] = $form->selectyesno("fournisseur",$this->fournisseur,1);
|
||||||
$this->tpl['suppliercode'] = $this->code_fournisseur;
|
$this->tpl['suppliercode'] = $this->code_fournisseur;
|
||||||
if ($modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this,1);
|
if ((!$this->code_fournisseur || $this->code_fournisseur == -1) && $modCodeFournisseur->code_auto) $this->tpl['suppliercode'] = $modCodeFournisseur->getNextValue($this,1);
|
||||||
|
$this->tpl['ismodifiable_suppliercode'] = $this->codefournisseur_modifiable();
|
||||||
$s=$modCodeFournisseur->getToolTip($langs,$this,1);
|
$s=$modCodeFournisseur->getToolTip($langs,$this,1);
|
||||||
$this->tpl['help_suppliercode'] = $form->textwithpicto('',$s,1);
|
$this->tpl['help_suppliercode'] = $form->textwithpicto('',$s,1);
|
||||||
|
|
||||||
$this->LoadSupplierCateg();
|
$this->LoadSupplierCateg();
|
||||||
$this->tpl['suppliercategory'] = $this->SupplierCategories;
|
$this->tpl['suppliercategory'] = $this->SupplierCategories;
|
||||||
$this->tpl['select_suppliercategory'] = $form->selectarray("fournisseur_categorie",$this->SupplierCategories,$_POST["fournisseur_categorie"],1);
|
$this->tpl['select_suppliercategory'] = $form->selectarray("fournisseur_categorie",$this->SupplierCategories,$_POST["fournisseur_categorie"],1);
|
||||||
@@ -2220,7 +2237,7 @@ class Societe extends CommonObject
|
|||||||
if ($conf->global->MAIN_MULTILANGS) $this->tpl['select_lang'] = $formadmin->select_language(($this->default_lang?$this->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1);
|
if ($conf->global->MAIN_MULTILANGS) $this->tpl['select_lang'] = $formadmin->select_language(($this->default_lang?$this->default_lang:$conf->global->MAIN_LANG_DEFAULT),'default_lang',0,0,1);
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
$this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value',1,1); // Assujeti par defaut en creation
|
$this->tpl['yn_assujtva'] = $form->selectyesno('assujtva_value',$this->tpl['tva_assuj'],1); // Assujeti par defaut en creation
|
||||||
|
|
||||||
// Select users
|
// Select users
|
||||||
$this->tpl['select_users'] = $form->select_dolusers($this->commercial_id,'commercial_id',1);
|
$this->tpl['select_users'] = $form->select_dolusers($this->commercial_id,'commercial_id',1);
|
||||||
@@ -2234,21 +2251,21 @@ class Societe extends CommonObject
|
|||||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
||||||
{
|
{
|
||||||
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>';
|
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>';
|
||||||
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',0,1);
|
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->localtax1_assuj,1);
|
||||||
$this->tpl['localtax'].= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>';
|
$this->tpl['localtax'].= '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>';
|
||||||
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',0,1);
|
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->localtax1_assuj,1);
|
||||||
$this->tpl['localtax'].= '</td></tr>';
|
$this->tpl['localtax'].= '</td></tr>';
|
||||||
}
|
}
|
||||||
elseif($mysoc->localtax1_assuj=="1")
|
elseif($mysoc->localtax1_assuj=="1")
|
||||||
{
|
{
|
||||||
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">';
|
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">';
|
||||||
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',0,1);
|
$this->tpl['localtax'].= $form->selectyesno('localtax1assuj_value',$this->localtax1_assuj,1);
|
||||||
$this->tpl['localtax'].= '</td><tr>';
|
$this->tpl['localtax'].= '</td><tr>';
|
||||||
}
|
}
|
||||||
elseif($mysoc->localtax2_assuj=="1")
|
elseif($mysoc->localtax2_assuj=="1")
|
||||||
{
|
{
|
||||||
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">';
|
$this->tpl['localtax'].= '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">';
|
||||||
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',0,1);
|
$this->tpl['localtax'].= $form->selectyesno('localtax2assuj_value',$this->localtax1_assuj,1);
|
||||||
$this->tpl['localtax'].= '</td><tr>';
|
$this->tpl['localtax'].= '</td><tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2349,7 +2366,65 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Assigne les valeurs POST dans l'objet
|
||||||
|
*/
|
||||||
|
function assign_post()
|
||||||
|
{
|
||||||
|
$this->id = $_POST["socid"];
|
||||||
|
$this->nom = $_POST["nom"];
|
||||||
|
$this->prefix_comm = $_POST["prefix_comm"];
|
||||||
|
$this->client = $_POST["client"];
|
||||||
|
$this->code_client = $_POST["code_client"];
|
||||||
|
$this->fournisseur = $_POST["fournisseur"];
|
||||||
|
$this->code_fournisseur = $_POST["code_fournisseur"];
|
||||||
|
$this->adresse = $_POST["adresse"]; // TODO obsolete
|
||||||
|
$this->address = $_POST["adresse"];
|
||||||
|
$this->cp = $_POST["cp"];
|
||||||
|
$this->ville = $_POST["ville"];
|
||||||
|
$this->pays_id = $_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
|
||||||
|
$this->departement_id = $_POST["departement_id"];
|
||||||
|
$this->tel = $_POST["tel"];
|
||||||
|
$this->fax = $_POST["fax"];
|
||||||
|
$this->email = $_POST["email"];
|
||||||
|
$this->url = $_POST["url"];
|
||||||
|
$this->capital = $_POST["capital"];
|
||||||
|
$this->siren = $_POST["idprof1"];
|
||||||
|
$this->siret = $_POST["idprof2"];
|
||||||
|
$this->ape = $_POST["idprof3"];
|
||||||
|
$this->idprof4 = $_POST["idprof4"];
|
||||||
|
$this->typent_id = $_POST["typent_id"];
|
||||||
|
$this->effectif_id = $_POST["effectif_id"];
|
||||||
|
$this->gencod = $_POST["gencod"];
|
||||||
|
$this->forme_juridique_code = $_POST["forme_juridique_code"];
|
||||||
|
$this->default_lang = $_POST["default_lang"];
|
||||||
|
$this->commercial_id = $_POST["commercial_id"];
|
||||||
|
|
||||||
|
$this->tva_assuj = $_POST["assujtva_value"];
|
||||||
|
$this->tva_intra = $_POST["tva_intra"];
|
||||||
|
|
||||||
|
//Local Taxes
|
||||||
|
$this->localtax1_assuj = $_POST["localtax1assuj_value"];
|
||||||
|
$this->localtax2_assuj = $_POST["localtax2assuj_value"];
|
||||||
|
|
||||||
|
// We set pays_id, and pays_code label of the chosen country
|
||||||
|
if ($this->pays_id)
|
||||||
|
{
|
||||||
|
$sql = "SELECT code, libelle FROM ".MAIN_DB_PREFIX."c_pays WHERE rowid = ".$this->pays_id;
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
$this->pays_code = $obj->code;
|
||||||
|
$this->pays = $langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
|
|||||||
if (empty($soc->object->fournisseur)&& empty($oldsoc->code_fournisseur)) $soc->object->code_fournisseur='';
|
if (empty($soc->object->fournisseur)&& empty($oldsoc->code_fournisseur)) $soc->object->code_fournisseur='';
|
||||||
//var_dump($soc);exit;
|
//var_dump($soc);exit;
|
||||||
|
|
||||||
$result = $soc->object->update($socid,$user,1,$oldsoc->codeclient_modifiable(),$oldsoc->codefournisseur_modifiable());
|
$result = $soc->object->update($socid,$user,1,$oldsoc->object->codeclient_modifiable(),$oldsoc->object->codefournisseur_modifiable());
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
|
Header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid);
|
||||||
@@ -375,73 +375,12 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
|
|||||||
*/
|
*/
|
||||||
if ($user->rights->societe->creer)
|
if ($user->rights->societe->creer)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Company Fact creation mode
|
|
||||||
*/
|
|
||||||
if ($_GET["type"]=='f') { $soc->object->fournisseur=1; }
|
|
||||||
if ($_GET["type"]=='c') { $soc->object->client=1; }
|
|
||||||
if ($_GET["type"]=='p') { $soc->object->client=2; }
|
|
||||||
if ($_GET["type"]=='cp') { $soc->object->client=3; }
|
|
||||||
if ($_REQUEST["private"]==1) { $soc->object->particulier=1; }
|
|
||||||
|
|
||||||
$soc->object->nom=$_POST["nom"];
|
|
||||||
$soc->object->prenom=$_POST["prenom"];
|
|
||||||
$soc->object->particulier=$_REQUEST["private"];
|
|
||||||
$soc->object->prefix_comm=$_POST["prefix_comm"];
|
|
||||||
$soc->object->client=$_POST["client"]?$_POST["client"]:$soc->object->client;
|
|
||||||
$soc->object->code_client=$_POST["code_client"];
|
|
||||||
$soc->object->fournisseur=$_POST["fournisseur"]?$_POST["fournisseur"]:$soc->object->fournisseur;
|
|
||||||
$soc->object->code_fournisseur=$_POST["code_fournisseur"];
|
|
||||||
$soc->object->adresse=$_POST["adresse"];
|
|
||||||
$soc->object->address=$_POST["adresse"]; // TODO obsolete
|
|
||||||
$soc->object->cp=$_POST["cp"];
|
|
||||||
$soc->object->ville=$_POST["ville"];
|
|
||||||
$soc->object->departement_id=$_POST["departement_id"];
|
|
||||||
$soc->object->tel=$_POST["tel"];
|
|
||||||
$soc->object->fax=$_POST["fax"];
|
|
||||||
$soc->object->email=$_POST["email"];
|
|
||||||
$soc->object->url=$_POST["url"];
|
|
||||||
$soc->object->capital=$_POST["capital"];
|
|
||||||
$soc->object->gencod=$_POST["gencod"];
|
|
||||||
$soc->object->siren=$_POST["idprof1"];
|
|
||||||
$soc->object->siret=$_POST["idprof2"];
|
|
||||||
$soc->object->ape=$_POST["idprof3"];
|
|
||||||
$soc->object->idprof4=$_POST["idprof4"];
|
|
||||||
$soc->object->typent_id=($_POST["typent_id"]&&!$_POST["cleartype"])?$_POST["typent_id"]:($_REQUEST["private"]?'TE_PRIVATE':'');
|
|
||||||
$soc->object->effectif_id=($_POST["effectif_id"]&&!$_POST["cleartype"])?$_POST["effectif_id_id"]:($_REQUEST["private"]?'EF1-5':'');
|
|
||||||
|
|
||||||
$soc->object->tva_assuj = $_POST["assujtva_value"];
|
|
||||||
|
|
||||||
//Local Taxes
|
|
||||||
$soc->object->localtax1_assuj = $_POST["localtax1assuj_value"];
|
|
||||||
$soc->object->localtax2_assuj = $_POST["localtax2assuj_value"];
|
|
||||||
|
|
||||||
$soc->object->tva_intra=$_POST["tva_intra"];
|
|
||||||
|
|
||||||
$soc->object->commercial_id=$_POST["commercial_id"];
|
|
||||||
$soc->object->default_lang=$_POST["default_lang"];
|
|
||||||
|
|
||||||
// We set pays_id, pays_code and label for the selected country
|
|
||||||
$soc->object->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
|
|
||||||
if ($soc->object->pays_id)
|
|
||||||
{
|
|
||||||
$sql = "SELECT code, libelle";
|
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_pays";
|
|
||||||
$sql.= " WHERE rowid = ".$soc->object->pays_id;
|
|
||||||
$resql=$db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
$soc->object->pays_code=$obj->code;
|
|
||||||
$soc->object->pays=$obj->libelle;
|
|
||||||
}
|
|
||||||
|
|
||||||
print_fiche_titre($langs->trans("NewCompany"));
|
print_fiche_titre($langs->trans("NewCompany"));
|
||||||
|
|
||||||
|
$soc->object->assign_post();
|
||||||
|
|
||||||
|
// Assign values
|
||||||
|
$soc->assign_values('create');
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
@@ -479,9 +418,7 @@ $_GET["action"] == 'create' || $_POST["action"] == 'create')
|
|||||||
}
|
}
|
||||||
|
|
||||||
dol_htmloutput_errors($soc->object->error,$soc->object->errors);
|
dol_htmloutput_errors($soc->object->error,$soc->object->errors);
|
||||||
|
|
||||||
// Assign values
|
|
||||||
$soc->assign_values('create');
|
|
||||||
// Display canvas
|
// Display canvas
|
||||||
$soc->display_canvas();
|
$soc->display_canvas();
|
||||||
|
|
||||||
@@ -496,96 +433,19 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
|
|||||||
|
|
||||||
if ($socid)
|
if ($socid)
|
||||||
{
|
{
|
||||||
// Load object modCodeTiers
|
if ($reload || ! $_POST["nom"])
|
||||||
$module=$conf->global->SOCIETE_CODECLIENT_ADDON;
|
|
||||||
if (! $module) dolibarr_error('',$langs->trans("ErrorModuleThirdPartyCodeInCompanyModuleNotDefined"));
|
|
||||||
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
|
|
||||||
{
|
{
|
||||||
$module = substr($module, 0, dol_strlen($module)-4);
|
$soc = new Canvas($db);
|
||||||
}
|
$soc->load_canvas('thirdparty@societe',$canvas);
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
|
$soc->object->id = $socid;
|
||||||
$modCodeClient = new $module;
|
$soc->fetch($socid, $_GET["action"]);
|
||||||
// We verified if the tag prefix is used
|
|
||||||
if ($modCodeClient->code_auto)
|
|
||||||
{
|
|
||||||
$prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed();
|
|
||||||
}
|
|
||||||
$module=$conf->global->SOCIETE_CODEFOURNISSEUR_ADDON;
|
|
||||||
if (! $module) $module=$conf->global->SOCIETE_CODECLIENT_ADDON;
|
|
||||||
if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php')
|
|
||||||
{
|
|
||||||
$module = substr($module, 0, dol_strlen($module)-4);
|
|
||||||
}
|
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/includes/modules/societe/".$module.".php");
|
|
||||||
$modCodeFournisseur = new $module;
|
|
||||||
// On verifie si la balise prefix est utilisee
|
|
||||||
if ($modCodeFournisseur->code_auto)
|
|
||||||
{
|
|
||||||
$prefixSupplierIsUsed = $modCodeFournisseur->verif_prefixIsUsed();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($reload || ! $_POST["nom"])
|
|
||||||
{
|
|
||||||
$soc = new Societe($db);
|
|
||||||
$soc->id = $socid;
|
|
||||||
$soc->fetch($socid);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$soc->id=$_POST["socid"];
|
$soc->object->assign_post();
|
||||||
$soc->nom=$_POST["nom"];
|
|
||||||
$soc->prefix_comm=$_POST["prefix_comm"];
|
|
||||||
$soc->client=$_POST["client"];
|
|
||||||
$soc->code_client=$_POST["code_client"];
|
|
||||||
$soc->fournisseur=$_POST["fournisseur"];
|
|
||||||
$soc->code_fournisseur=$_POST["code_fournisseur"];
|
|
||||||
$soc->adresse=$_POST["adresse"]; // TODO obsolete
|
|
||||||
$soc->address=$_POST["adresse"];
|
|
||||||
$soc->cp=$_POST["cp"];
|
|
||||||
$soc->ville=$_POST["ville"];
|
|
||||||
$soc->pays_id=$_POST["pays_id"]?$_POST["pays_id"]:$mysoc->pays_id;
|
|
||||||
$soc->departement_id=$_POST["departement_id"];
|
|
||||||
$soc->tel=$_POST["tel"];
|
|
||||||
$soc->fax=$_POST["fax"];
|
|
||||||
$soc->email=$_POST["email"];
|
|
||||||
$soc->url=$_POST["url"];
|
|
||||||
$soc->capital=$_POST["capital"];
|
|
||||||
$soc->siren=$_POST["idprof1"];
|
|
||||||
$soc->siret=$_POST["idprof2"];
|
|
||||||
$soc->ape=$_POST["idprof3"];
|
|
||||||
$soc->idprof4=$_POST["idprof4"];
|
|
||||||
$soc->typent_id=$_POST["typent_id"];
|
|
||||||
$soc->effectif_id=$_POST["effectif_id"];
|
|
||||||
$soc->gencod=$_POST["gencod"];
|
|
||||||
$soc->forme_juridique_code=$_POST["forme_juridique_code"];
|
|
||||||
$soc->default_lang=$_POST["default_lang"];
|
|
||||||
|
|
||||||
$soc->tva_assuj = $_POST["assujtva_value"];
|
|
||||||
$soc->tva_intra=$_POST["tva_intra"];
|
|
||||||
|
|
||||||
//Local Taxes
|
|
||||||
$soc->localtax1_assuj = $_POST["localtax1assuj_value"];
|
|
||||||
$soc->localtax2_assuj = $_POST["localtax2assuj_value"];
|
|
||||||
|
|
||||||
// We set pays_id, and pays_code label of the chosen country
|
|
||||||
if ($soc->pays_id)
|
|
||||||
{
|
|
||||||
$sql = "SELECT code, libelle from ".MAIN_DB_PREFIX."c_pays where rowid = ".$soc->pays_id;
|
|
||||||
$resql=$db->query($sql);
|
|
||||||
if ($resql)
|
|
||||||
{
|
|
||||||
$obj = $db->fetch_object($resql);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dol_print_error($db);
|
|
||||||
}
|
|
||||||
$soc->pays_code=$obj->code;
|
|
||||||
$soc->pays=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->libelle;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dol_htmloutput_errors($soc->error,$soc->errors);
|
dol_htmloutput_errors($soc->object->error,$soc->object->errors);
|
||||||
|
|
||||||
if ($conf->use_javascript_ajax)
|
if ($conf->use_javascript_ajax)
|
||||||
{
|
{
|
||||||
@@ -598,279 +458,12 @@ elseif ($_GET["action"] == 'edit' || $_POST["action"] == 'edit')
|
|||||||
})';
|
})';
|
||||||
print '</script>'."\n";
|
print '</script>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'?socid='.$soc->id.'" method="post" name="formsoc">';
|
// Assign values
|
||||||
print '<input type="hidden" name="action" value="update">';
|
$soc->assign_values('edit');
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
||||||
print '<input type="hidden" name="socid" value="'.$soc->id.'">';
|
// Display canvas
|
||||||
if ($modCodeClient->code_auto || $modCodeFournisseur->code_auto) print '<input type="hidden" name="code_auto" value="1">';
|
$soc->display_canvas();
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
|
|
||||||
// Name
|
|
||||||
print '<tr><td><span class="fieldrequired">'.$langs->trans('Name').'</span></td><td colspan="3"><input type="text" size="40" maxlength="60" name="nom" value="'.$soc->nom.'"></td></tr>';
|
|
||||||
|
|
||||||
// Prefix
|
|
||||||
print '<tr><td>'.$langs->trans("Prefix").'</td><td colspan="3">';
|
|
||||||
// It does not change the prefix mode using the auto numbering prefix
|
|
||||||
if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $soc->prefix_comm)
|
|
||||||
{
|
|
||||||
print '<input type="hidden" name="prefix_comm" value="'.$soc->prefix_comm.'">';
|
|
||||||
print $soc->prefix_comm;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<input type="text" size="5" maxlength="5" name="prefix_comm" value="'.$soc->prefix_comm.'">';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// Prospect/Customer
|
|
||||||
print '<tr><td width="25%"><span class="fieldrequired">'.$langs->trans('ProspectCustomer').'</span></td><td width="25%"><select class="flat" name="client">';
|
|
||||||
print '<option value="2"'.($soc->client==2?' selected="true"':'').'>'.$langs->trans('Prospect').'</option>';
|
|
||||||
print '<option value="3"'.($soc->client==3?' selected="true"':'').'>'.$langs->trans('ProspectCustomer').'</option>';
|
|
||||||
print '<option value="1"'.($soc->client==1?' selected="true"':'').'>'.$langs->trans('Customer').'</option>';
|
|
||||||
print '<option value="0"'.($soc->client==0?' selected="true"':'').'>'.$langs->trans('NorProspectNorCustomer').'</option>';
|
|
||||||
print '</select></td>';
|
|
||||||
print '<td width="25%">'.$langs->trans('CustomerCode').'</td><td width="25%">';
|
|
||||||
|
|
||||||
print '<table class="nobordernopadding"><tr><td>';
|
|
||||||
if ((!$soc->code_client || $soc->code_client == -1) && $modCodeClient->code_auto)
|
|
||||||
{
|
|
||||||
$tmpcode=$soc->code_client;
|
|
||||||
if (empty($tmpcode) && $modCodeClient->code_auto) $tmpcode=$modCodeClient->getNextValue($soc,0);
|
|
||||||
print '<input type="text" name="code_client" size="16" value="'.$tmpcode.'" maxlength="15">';
|
|
||||||
}
|
|
||||||
else if ($soc->codeclient_modifiable())
|
|
||||||
{
|
|
||||||
print '<input type="text" name="code_client" size="16" value="'.$soc->code_client.'" maxlength="15">';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $soc->code_client;
|
|
||||||
print '<input type="hidden" name="code_client" value="'.$soc->code_client.'">';
|
|
||||||
}
|
|
||||||
print '</td><td>';
|
|
||||||
$s=$modCodeClient->getToolTip($langs,$soc,0);
|
|
||||||
print $form->textwithpicto('',$s,1);
|
|
||||||
print '</td></tr></table>';
|
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Supplier
|
|
||||||
print '<tr>';
|
|
||||||
print '<td><span class="fieldrequired">'.$langs->trans('Supplier').'</span></td><td>';
|
|
||||||
print $form->selectyesno("fournisseur",$soc->fournisseur,1);
|
|
||||||
print '</td>';
|
|
||||||
print '<td>'.$langs->trans('SupplierCode').'</td><td>';
|
|
||||||
|
|
||||||
print '<table class="nobordernopadding"><tr><td>';
|
|
||||||
if ((!$soc->code_fournisseur || $soc->code_fournisseur == -1) && $modCodeFournisseur->code_auto)
|
|
||||||
{
|
|
||||||
$tmpcode=$soc->code_fournisseur;
|
|
||||||
if (empty($tmpcode) && $modCodeFournisseur->code_auto) $tmpcode=$modCodeFournisseur->getNextValue($soc,1);
|
|
||||||
print '<input type="text" name="code_fournisseur" size="16" value="'.$tmpcode.'" maxlength="15">';
|
|
||||||
}
|
|
||||||
else if ($soc->codefournisseur_modifiable())
|
|
||||||
{
|
|
||||||
print '<input type="text" name="code_fournisseur" size="16" value="'.$soc->code_fournisseur.'" maxlength="15">';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $soc->code_fournisseur;
|
|
||||||
print '<input type="hidden" name="code_fournisseur" value="'.$soc->code_fournisseur.'">';
|
|
||||||
}
|
|
||||||
print '</td><td>';
|
|
||||||
$s=$modCodeFournisseur->getToolTip($langs,$soc,1);
|
|
||||||
print $form->textwithpicto('',$s,1);
|
|
||||||
print '</td></tr></table>';
|
|
||||||
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Category
|
|
||||||
if ($soc->fournisseur)
|
|
||||||
{
|
|
||||||
$load = $soc->LoadSupplierCateg();
|
|
||||||
if ( $load == 0)
|
|
||||||
{
|
|
||||||
if (sizeof($soc->SupplierCategories) > 0)
|
|
||||||
{
|
|
||||||
print '<tr>';
|
|
||||||
print '<td>'.$langs->trans('SupplierCategory').'</td><td colspan="3">';
|
|
||||||
print $form->selectarray("fournisseur_categorie",$soc->SupplierCategories,'',1);
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($conf->global->MAIN_MODULE_BARCODE)
|
|
||||||
{
|
|
||||||
print '<tr><td valign="top">'.$langs->trans('Gencod').'</td><td colspan="3"><input type="text" name="gencod" value="'.$soc->gencod.'">';
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Address
|
|
||||||
print '<tr><td valign="top">'.$langs->trans('Address').'</td><td colspan="3"><textarea name="adresse" cols="40" rows="3" wrap="soft">';
|
|
||||||
print $soc->address;
|
|
||||||
print '</textarea></td></tr>';
|
|
||||||
|
|
||||||
// Zip / Town
|
|
||||||
print '<tr><td>'.$langs->trans('Zip').'</td><td><input size="6" type="text" name="cp" value="'.$soc->cp.'">';
|
|
||||||
if ($conf->use_javascript_ajax && $conf->global->MAIN_AUTOFILL_TOWNFROMZIP) print ' <input class="button" type="button" name="searchpostalcode" value="'.$langs->trans('FillTownFromZip').'" onclick="autofilltownfromzip_PopupPostalCode(\''.DOL_URL_ROOT.'\',cp.value,ville,pays_id,departement_id)">';
|
|
||||||
print '</td>';
|
|
||||||
print '<td>'.$langs->trans('Town').'</td><td><input type="text" name="ville" value="'.$soc->ville.'"></td></tr>';
|
|
||||||
|
|
||||||
// Country
|
|
||||||
print '<tr><td>'.$langs->trans('Country').'</td><td colspan="3">';
|
|
||||||
$form->select_pays($soc->pays_id,'pays_id');
|
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Department
|
|
||||||
print '<tr><td>'.$langs->trans('State').'</td><td colspan="3">';
|
|
||||||
$formcompany->select_departement($soc->departement_id,$soc->pays_code);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
// Phone / Fax
|
|
||||||
print '<tr><td>'.$langs->trans('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>';
|
|
||||||
|
|
||||||
// EMail / Web
|
|
||||||
print '<tr><td>'.$langs->trans('EMail').($conf->global->SOCIETE_MAIL_REQUIRED?'*':'').'</td><td><input type="text" name="email" size="32" value="'.$soc->email.'"></td>';
|
|
||||||
print '<td>'.$langs->trans('Web').'</td><td><input type="text" name="url" size="32" value="'.$soc->url.'"></td></tr>';
|
|
||||||
|
|
||||||
print '<tr>';
|
|
||||||
// IdProf1 (SIREN for France)
|
|
||||||
$idprof=$langs->transcountry('ProfId1',$soc->pays_code);
|
|
||||||
if ($idprof!='-')
|
|
||||||
{
|
|
||||||
print '<td>'.$idprof.'</td><td>';
|
|
||||||
$soc->show_input_id_prof(1,'idprof1',$soc->siren);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
else print '<td> </td><td> </td>';
|
|
||||||
// IdProf2 (SIRET for France)
|
|
||||||
$idprof=$langs->transcountry('ProfId2',$soc->pays_code);
|
|
||||||
if ($idprof!='-')
|
|
||||||
{
|
|
||||||
print '<td>'.$idprof.'</td><td>';
|
|
||||||
$soc->show_input_id_prof(2,'idprof2',$soc->siret);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
else print '<td> </td><td> </td>';
|
|
||||||
print '</tr>';
|
|
||||||
print '<tr>';
|
|
||||||
// IdProf3 (APE for France)
|
|
||||||
$idprof=$langs->transcountry('ProfId3',$soc->pays_code);
|
|
||||||
if ($idprof!='-')
|
|
||||||
{
|
|
||||||
print '<td>'.$idprof.'</td><td>';
|
|
||||||
$soc->show_input_id_prof(3,'idprof3',$soc->ape);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
else print '<td> </td><td> </td>';
|
|
||||||
// IdProf4 (NU for France)
|
|
||||||
$idprof=$langs->transcountry('ProfId4',$soc->pays_code);
|
|
||||||
if ($idprof!='-')
|
|
||||||
{
|
|
||||||
print '<td>'.$idprof.'</td><td>';
|
|
||||||
$soc->show_input_id_prof(4,'idprof4',$soc->idprof4);
|
|
||||||
print '</td>';
|
|
||||||
}
|
|
||||||
else print '<td> </td><td> </td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// VAT payers
|
|
||||||
print '<tr><td>'.$langs->trans('VATIsUsed').'</td><td>';
|
|
||||||
print $form->selectyesno('assujtva_value',$soc->tva_assuj,1);
|
|
||||||
print '</td>';
|
|
||||||
|
|
||||||
// VAT Code
|
|
||||||
if ($conf->use_javascript_ajax)
|
|
||||||
{
|
|
||||||
print "\n";
|
|
||||||
print '<script language="JavaScript" type="text/javascript">';
|
|
||||||
print "function CheckVAT(a) {\n";
|
|
||||||
print "newpopup('".DOL_URL_ROOT."/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".dol_escape_js($langs->trans("VATIntraCheckableOnEUSite"))."',500,260);\n";
|
|
||||||
print "}\n";
|
|
||||||
print '</script>';
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
print '<td nowrap="nowrap">'.$langs->trans('VATIntra').'</td>';
|
|
||||||
print '<td nowrap="nowrap">';
|
|
||||||
$s ='<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$soc->tva_intra.'">';
|
|
||||||
$s.=' ';
|
|
||||||
if ($conf->use_javascript_ajax)
|
|
||||||
{
|
|
||||||
$s.='<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans("VATIntraCheck").'</a>';
|
|
||||||
print $form->textwithpicto($s,$langs->trans("VATIntraCheckDesc",$langs->trans("VATIntraCheck")),1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print $s.'<a href="'.$langs->transcountry("VATIntraCheckURL",$soc->id_pays).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"),'help').'</a>';
|
|
||||||
}
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
|
|
||||||
// Local Taxes
|
|
||||||
if($mysoc->pays_code=='ES')
|
|
||||||
{
|
|
||||||
if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1")
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td>';
|
|
||||||
print $form->selectyesno('localtax1assuj_value',$soc->localtax1_assuj,1);
|
|
||||||
print '</td><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td>';
|
|
||||||
print $form->selectyesno('localtax2assuj_value',$soc->localtax2_assuj,1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
}
|
|
||||||
elseif($mysoc->localtax1_assuj=="1")
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("LocalTax1IsUsedES").'</td><td colspan="3">';
|
|
||||||
print $form->selectyesno('localtax1assuj_value',$soc->localtax1_assuj,1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
}
|
|
||||||
elseif($mysoc->localtax2_assuj=="1")
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("LocalTax2IsUsedES").'</td><td colspan="3">';
|
|
||||||
print $form->selectyesno('localtax2assuj_value',$soc->localtax2_assuj,1);
|
|
||||||
print '</td></tr>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Capital").'</td><td colspan="3"><input type="text" name="capital" size="10" value="'.$soc->capital.'"> '.$langs->trans("Currency".$conf->monnaie).'</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans('JuridicalStatus').'</td><td colspan="3">';
|
|
||||||
$formcompany->select_forme_juridique($soc->forme_juridique_code,$soc->pays_code);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
print '<tr><td>'.$langs->trans("Type").'</td><td>';
|
|
||||||
print $form->selectarray("typent_id",$formcompany->typent_array(0), $soc->typent_id);
|
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
|
||||||
print '</td>';
|
|
||||||
print '<td>'.$langs->trans("Staff").'</td><td>';
|
|
||||||
print $form->selectarray("effectif_id",$formcompany->effectif_array(0), $soc->effectif_id);
|
|
||||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
|
|
||||||
print '</td></tr>';
|
|
||||||
|
|
||||||
if ($conf->global->MAIN_MULTILANGS)
|
|
||||||
{
|
|
||||||
print '<tr><td>'.$langs->trans("DefaultLang").'</td><td colspan="3">'."\n";
|
|
||||||
$formadmin->select_lang($soc->default_lang,'default_lang',0,0,1);
|
|
||||||
print '</td>';
|
|
||||||
print '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print '</table>';
|
|
||||||
print '<br>';
|
|
||||||
|
|
||||||
print '<center>';
|
|
||||||
print '<input type="submit" class="button" name="save" value="'.$langs->trans("Save").'">';
|
|
||||||
print ' ';
|
|
||||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'">';
|
|
||||||
print '</center>';
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user