Skip to content

Commit be62d67

Browse files
committed
Add professional ID int company profile
1 parent 493c9e6 commit be62d67

File tree

2 files changed

+50
-4
lines changed

2 files changed

+50
-4
lines changed

myaccount/index.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@
9999
* @var DoliDB $db
100100
* @var Translate $langs
101101
* @var Societe $mysoc
102+
* @var User $user
102103
*/
103104
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
104105
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
@@ -1027,6 +1028,7 @@
10271028
$country_code = GETPOST('country_id', 'aZ09');
10281029
$vatassuj = (GETPOST('vatassuj', 'alphanohtml') == 'on' ? 1 : 0);
10291030
$vatnumber = GETPOST('vatnumber', 'alphanohtml');
1031+
$profid = GETPOST('profid', 'alphanohtml');
10301032

10311033
if (empty($orgname)) {
10321034
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NameOfCompany")), null, 'errors');
@@ -1053,6 +1055,7 @@
10531055
}
10541056
$mythirdpartyaccount->tva_assuj = $vatassuj;
10551057
$mythirdpartyaccount->tva_intra = preg_replace('/\s/', '', $vatnumber);
1058+
$mythirdpartyaccount->idprof1 = $profid;
10561059

10571060
if ($mythirdpartyaccount->tva_assuj && $mythirdpartyaccount->tva_intra) {
10581061
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';

myaccount/tpl/myaccount.tpl.php

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
<div class="caption-subject font-green-sharp bold uppercase">'.$langs->trans("Organization").' <small>('.$langs->trans("Code").' '.dolPrintHTML($mythirdpartyaccount->code_client).')</small></div>
7272
</div>
7373
<div class="portlet-body">
74-
74+
<!-- form for company profile -->
7575
<form action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">
7676
<input type="hidden" name="token" value="'.newToken().'">
7777
<input type="hidden" name="action" value="updatemythirdpartyaccount">
@@ -101,7 +101,7 @@
101101
<input type="text" class="form-control" name="stateorcounty" value="">
102102
</div>
103103
<div class="form-group">
104-
<label>'.$langs->trans("Country").'</label><br>';
104+
<label>'.$langs->trans("Country").'</label> &nbsp; ';
105105
$countryselected = (GETPOSTISSET('country_id') ? GETPOST('country_id', 'aZ09') : $mythirdpartyaccount->country_id);
106106
$exclude_country_code = array();
107107
if (getDolGlobalString('SELLYOURSAAS_EXCLUDE_COUNTRY_CODES')) {
@@ -111,7 +111,9 @@
111111
print $form->select_country($countryselected, 'country_id', '', 0, 'minwidth300', 'code2', 0, 1, 0, $exclude_country_code);
112112
print '</div>'."\n";
113113

114+
114115
if (!getDolGlobalInt('SELLYOURSAAS_ONLY_NON_PROFIT_ORGA')) {
116+
// VAT Section
115117
print '<div class="form-group">
116118
<label>'.$langs->trans("VATIntra").'</label> ';
117119
if (! empty($mythirdpartyaccount->tva_assuj) && empty($mythirdpartyaccount->tva_intra)) {
@@ -130,8 +132,8 @@
130132
}
131133

132134
print '
133-
<br>
134-
<input type="hidden" name="vatassuj_old" value="'.($mythirdpartyaccount->tva_assuj).'">
135+
<br><br>
136+
<input type="hidden" name="vatassuj_old" value="'.$mythirdpartyaccount->tva_assuj.'">
135137
<input type="checkbox" style="margin-bottom: 3px;" class="inline-block valignmiddle"'.($mythirdpartyaccount->tva_assuj ? ' checked="checked"' : '').' id="vatassuj" name="vatassuj"> <label for="vatassuj" class="valignmiddle nobold">'.$langs->trans("IHaveAVATID").'</label>
136138
<br>
137139
<input type="hidden" name="vatnumber_old" value="'.$mythirdpartyaccount->tva_intra.'">
@@ -165,6 +167,47 @@
165167
print $s;
166168
}
167169
print '</div>'."\n";
170+
171+
172+
// ID Prof section
173+
$placeholderforprofid = '';
174+
$mandatoryprofid = 0;
175+
if ($mythirdpartyaccount->country_code == 'FR') {
176+
//$placeholderforprofid='Exemple: FR12345678';
177+
$mandatoryprofid = 1;
178+
} elseif ($mythirdpartyaccount->country_code == 'BE') {
179+
//$placeholderforprofid='Exemple: BE12345678';
180+
} elseif ($mythirdpartyaccount->country_code == 'ES') {
181+
//$placeholderforprofid='Exemple: ES12345678';
182+
} else {
183+
//$placeholderforprofid=$langs->trans("EnterVATHere");
184+
}
185+
186+
print '<div class="form-group">
187+
<label>'.$langs->transcountry("ProfId", $mythirdpartyaccount->country_code).'</label> ';
188+
if ($mandatoryprofid && ! empty($mythirdpartyaccount->idprof1) && empty($mythirdpartyaccount->idprof1)) {
189+
print img_warning($langs->trans("Mandatory"), '', 'hideifnoprof');
190+
}
191+
192+
print '
193+
<br><br>
194+
<input type="hidden" name="profid_old" value="'.$mythirdpartyaccount->idprof1.'">
195+
<input type="text" class="input-small quatrevingtpercent" value="'.$mythirdpartyaccount->idprof1.'" name="profid" id="profid" placeholder="'.$placeholderforprofid.'">
196+
';
197+
print "\n";
198+
/*
199+
print '<script>';
200+
print '$( document ).ready(function() {'."\n";
201+
print '$("#profid").keyup(function() {'."\n";
202+
print " console.log('We change the profid='+$('#profid').val());\n";
203+
print " if ($('#profid').val() != '') { $('#profid').prop('checked', true ); }\n";
204+
print '});'."\n";
205+
print '});'."\n";
206+
print '</script>';
207+
print "\n";
208+
*/
209+
210+
print '</div>'."\n";
168211
}
169212

170213
print '

0 commit comments

Comments
 (0)