24 include_once DOL_DOCUMENT_ROOT.
'/societe/canvas/actions_card_common.class.php';
43 public function __construct($db, $dirmodule, $targetmodule, $canvas, $card)
46 $this->dirmodule = $dirmodule;
47 $this->targetmodule = $targetmodule;
48 $this->canvas = $canvas;
64 if ($action ==
'view') $out .= $langs->trans(
"ThirdParty");
65 if ($action ==
'edit') $out .= $langs->trans(
"EditCompany");
66 if ($action ==
'create') $out .= $langs->trans(
"NewCompany");
84 global $conf, $langs, $user, $mysoc;
85 global $form, $formadmin, $formcompany;
89 parent::assign_values($action);
93 $this->tpl[
'profid1'] = $this->
object->idprof1;
94 $this->tpl[
'profid2'] = $this->
object->idprof2;
95 $this->tpl[
'profid3'] = $this->
object->idprof3;
96 $this->tpl[
'profid4'] = $this->
object->idprof4;
98 if ($conf->use_javascript_ajax && empty($conf->global->MAIN_DISABLEVATCHECK))
101 $js .=
'<script language="JavaScript" type="text/javascript">';
102 $js .=
"function CheckVAT(a) {\n";
103 $js .=
"newpopup('".DOL_URL_ROOT.
"/societe/checkvat/checkVatPopup.php?vatNumber='+a,'".
dol_escape_js($langs->trans(
"VATIntraCheckableOnEUSite")).
"',500,230);\n";
107 $this->tpl[
'js_checkVatPopup'] = $js;
110 if ($action ==
'create' || $action ==
'edit')
112 for ($i = 1; $i <= 4; $i++)
114 $this->tpl[
'langprofid'.$i] = $langs->transcountry(
'ProfId'.$i, $this->object->country_code);
115 $this->tpl[
'showprofid'.$i] = $formcompany->get_input_id_prof($i,
'idprof'.$i, $this->tpl[
'profid'.$i], $this->object->country_code);
119 $this->tpl[
'select_companytype'] = $form->selectarray(
"typent_id", $formcompany->typent_array(0), $this->
object->typent_id);
122 $this->tpl[
'select_juridicalstatus'] = $formcompany->select_juridicalstatus($this->object->forme_juridique_code, $this->object->country_code);
125 $this->tpl[
'select_workforce'] = $form->selectarray(
"effectif_id", $formcompany->effectif_array(0), $this->
object->effectif_id);
128 $s =
'<input type="text" class="flat" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.
'">';
129 if (empty($conf->global->MAIN_DISABLEVATCHECK))
133 if ($conf->use_javascript_ajax)
135 $s .=
'<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
136 $this->tpl[
'tva_intra'] = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
138 $this->tpl[
'tva_intra'] = $s.
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", $this->object->country_id).
'" target="_blank">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
141 $this->tpl[
'tva_intra'] = $s;
145 if ($action ==
'delete')
147 $this->tpl[
'action_delete'] = $form->formconfirm(
$_SERVER[
"PHP_SELF"].
"?socid=".$this->object->id, $langs->trans(
"DeleteACompany"), $langs->trans(
"ConfirmDeleteCompany"),
"confirm_delete",
'', 0,
"1,action-delete");
150 for ($i = 1; $i <= 4; $i++)
152 $this->tpl[
'langprofid'.$i] = $langs->transcountry(
'ProfId'.$i, $this->object->country_code);
153 $this->tpl[
'checkprofid'.$i] = $this->
object->id_prof_check($i, $this->
object);
154 $this->tpl[
'urlprofid'.$i] = $this->
object->id_prof_url($i, $this->
object);
158 if ($this->object->tva_intra)
160 $s = $this->
object->tva_intra;
161 $s .=
'<input type="hidden" name="tva_intra" size="12" maxlength="20" value="'.$this->object->tva_intra.
'">';
162 if (empty($conf->global->MAIN_DISABLEVATCHECK))
166 if ($conf->use_javascript_ajax)
168 $s .=
'<a href="#" onclick="javascript: CheckVAT(document.formsoc.tva_intra.value);">'.$langs->trans(
"VATIntraCheck").
'</a>';
169 $this->tpl[
'tva_intra'] = $form->textwithpicto($s, $langs->trans(
"VATIntraCheckDesc", $langs->transnoentitiesnoconv(
"VATIntraCheck")), 1);
171 $this->tpl[
'tva_intra'] = $s.
'<a href="'.$langs->transcountry(
"VATIntraCheckURL", $this->object->country_id).
'" target="_blank">'.
img_picto($langs->trans(
"VATIntraCheckableOnEUSite"),
'help').
'</a>';
174 $this->tpl[
'tva_intra'] = $s;
177 $this->tpl[
'tva_intra'] =
' ';
181 if ($this->object->parent)
184 $socm->fetch($this->object->parent);
185 $this->tpl[
'parent_company'] = $socm->getNomUrl(1).
' '.($socm->code_client ?
"(".$socm->code_client.
")" :
"");
186 $this->tpl[
'parent_company'] .= ($socm->town ?
' - '.$socm->town :
'');
188 $this->tpl[
'parent_company'] = $langs->trans(
"NoParentCompany");
206 public function restrictedArea($user, $features =
'societe', $objectid = 0, $dbtablename =
'', $feature2 =
'', $dbt_keyfield =
'fk_soc', $dbt_select =
'rowid')
208 return restrictedArea($user, $features, $objectid, $dbtablename, $feature2, $dbt_keyfield, $dbt_select);
__construct($db, $dirmodule, $targetmodule, $canvas, $card)
Constructor.
Classe permettant la gestion des tiers par defaut.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
assign_values(&$action, $id=0, $ref= '')
Assign custom values for canvas (for example into this->tpl to be used by templates) ...
$conf db
API class for accounts.
Class to manage third parties objects (customers, suppliers, prospects...)
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
restrictedArea($user, $features= 'societe', $objectid=0, $dbtablename= '', $feature2= '', $dbt_keyfield= 'fk_soc', $dbt_select= 'rowid')
Check permissions of a user to show a page and an object.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
print $_SERVER["PHP_SELF"]
Edit parameters.
getObject($id, $ref= '')
Get object from id or ref and save it into this->object.
getTitle($action)
Return the title of card.