'.$langs->trans("AdherentMailRequired").' ';
print $form->selectyesno('ADHERENT_MAIL_REQUIRED', (getDolGlobalString('ADHERENT_MAIL_REQUIRED') ? $conf->global->ADHERENT_MAIL_REQUIRED : 0), 1);
diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php
index 2a0993efeb9..d835d1d8eba 100644
--- a/htdocs/adherents/stats/index.php
+++ b/htdocs/adherents/stats/index.php
@@ -48,8 +48,11 @@ if ($user->socid > 0) {
$result = restrictedArea($user, 'adherent', '', '', 'cotisation');
$year = dol_print_date(dol_now('gmt'), "%Y", 'gmt');
-$startyear = $year - (!getDolGlobalString('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
+$startyear = $year - (!getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS') ? 2 : max(1, min(10, getDolGlobalInt('MAIN_STATS_GRAPHS_SHOW_N_YEARS'))));
$endyear = $year;
+if (!empty(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) ) {
+ $endyear = dol_print_date(dol_time_plus_duree(dol_now('gmt'), (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1)), "%Y", 'gmt');
+}
// Load translation files required by the page
$langs->loadLangs(array("companies", "members"));
diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php
index b3e2770ecc5..1a679c87830 100644
--- a/htdocs/adherents/subscription.php
+++ b/htdocs/adherents/subscription.php
@@ -6,6 +6,7 @@
* Copyright (C) 2015-2016 Alexandre Spangaro
* Copyright (C) 2018-2023 Frédéric France
* Copyright (C) 2019 Thibault FOUCART
+ * Copyright (C) 2023 Waël Almoman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -53,7 +54,7 @@ $typeid = GETPOST('typeid', 'int');
$cancel = GETPOST('cancel');
// Load variable for pagination
-$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit;
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
$sortfield = GETPOST('sortfield', 'aZ09comma');
$sortorder = GETPOST('sortorder', 'aZ09comma');
$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
@@ -960,8 +961,6 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h
print ''."\n";
print '';
- $now = dol_now();
-
// Date payment
if (GETPOST('paymentyear') && GETPOST('paymentmonth') && GETPOST('paymentday')) {
$paymentdate = dol_mktime(0, 0, 0, GETPOST('paymentmonth'), GETPOST('paymentday'), GETPOST('paymentyear'));
@@ -977,10 +976,16 @@ if (($action == 'addsubscription' || $action == 'create_thirdparty') && $user->h
}
if (!$datefrom) {
$datefrom = $object->datevalid;
- if ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > dol_now()) {
+ if (!empty(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) ) {
+ $datefrom = dol_time_plus_duree($now, (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1));
+ } elseif ($object->datefin > 0 && dol_time_plus_duree($object->datefin, $defaultdelay, $defaultdelayunit) > $now) {
$datefrom = dol_time_plus_duree($object->datefin, 1, 'd');
- } else {
- $datefrom = dol_get_first_day($currentyear);
+ }
+
+ if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "m") {
+ $datefrom = dol_get_first_day(dol_print_date($datefrom, "%Y"), dol_print_date($datefrom, "%m"));
+ } elseif (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "Y") {
+ $datefrom = dol_get_first_day(dol_print_date($datefrom, "%Y"));
}
}
print $form->selectDate($datefrom, '', '', '', '', "subscription", 1, 1);
diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php
index 15ca3646425..b2a7d1b0a8d 100644
--- a/htdocs/compta/facture/card-rec.php
+++ b/htdocs/compta/facture/card-rec.php
@@ -1096,6 +1096,8 @@ if ($action == 'create') {
$title = $langs->trans("Recurrence");
print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"').$title, '', '');
+ print ''.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')).' ';
+
print dol_get_fiche_head(null, '', '', 0);
print '';
@@ -1118,7 +1120,7 @@ if ($action == 'create') {
print "";
// Auto validate the invoice
- print "".$langs->trans("StatusOfGeneratedInvoices")." ";
+ print " ".$langs->trans("StatusOfAutoGeneratedInvoices")." ";
$select = array('0'=>$langs->trans('BillStatusDraft'), '1'=>$langs->trans('BillStatusValidated'));
print $form->selectarray('auto_validate', $select, GETPOST('auto_validate'));
print " ";
diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php
index 371c3ffeb68..0825f223f19 100644
--- a/htdocs/compta/sociales/class/cchargesociales.class.php
+++ b/htdocs/compta/sociales/class/cchargesociales.class.php
@@ -366,7 +366,7 @@ class Cchargesociales
* @param int $fromid Id of object to clone
* @return int New id of clone
*/
- public function createFromClone(User $user, $fromid)
+ /*public function createFromClone(User $user, $fromid)
{
dol_syslog(__METHOD__, LOG_DEBUG);
@@ -406,7 +406,7 @@ class Cchargesociales
return -1;
}
- }
+ }*/
/**
* Return a link to the user card (with optionaly the picto)
@@ -419,7 +419,7 @@ class Cchargesociales
* @param string $morecss Add more css on link
* @return string String with URL
*/
- public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '')
+ /*public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '')
{
global $langs, $conf, $db;
global $dolibarr_main_authentication, $dolibarr_main_demo;
@@ -446,7 +446,7 @@ class Cchargesociales
}
$result .= $link.$this->ref.$linkend;
return $result;
- }
+ }*/
/**
* Return the label of the status
@@ -454,10 +454,10 @@ class Cchargesociales
* @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
* @return string Label of status
*/
- public function getLibStatut($mode = 0)
+ /*public function getLibStatut($mode = 0)
{
return $this->LibStatut($this->status, $mode);
- }
+ }*/
// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
/**
diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php
index fb43c8a526a..ac32bbebecc 100644
--- a/htdocs/compta/sociales/class/chargesociales.class.php
+++ b/htdocs/compta/sociales/class/chargesociales.class.php
@@ -741,9 +741,9 @@ class ChargeSociales extends CommonObject
$this->ref = 'SPECIMEN';
$this->specimen = 1;
$this->paye = 0;
- $this->date = dol_now();
- $this->date_ech = $this->date + 3600 * 24 * 30;
- $this->periode = $this->date + 3600 * 24 * 30;
+ $this->date_creation = dol_now();
+ $this->date_ech = $this->date_creation + 3600 * 24 * 30;
+ $this->periode = $this->date_creation + 3600 * 24 * 30;
$this->amount = 100;
$this->label = 'Social contribution label';
$this->type = 1;
diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
index a798eee92bb..1020b4cec00 100644
--- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
+++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php
@@ -61,6 +61,26 @@ class PaymentSocialContribution extends CommonObject
public $tms = '';
public $datep = '';
+ /**
+ * @var string
+ */
+ public $type_code;
+
+ /**
+ * @var string
+ */
+ public $type_label;
+
+ /**
+ * @var int
+ */
+ public $bank_account;
+
+ /**
+ * @var int
+ */
+ public $bank_line;
+
/**
* @deprecated
* @see $amount
diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php
index c7e59c640b5..a03d031e8c7 100644
--- a/htdocs/compta/tva/class/paymentvat.class.php
+++ b/htdocs/compta/tva/class/paymentvat.class.php
@@ -113,6 +113,26 @@ class PaymentVAT extends CommonObject
*/
public $datepaye;
+ /**
+ * @var string
+ */
+ public $type_code;
+
+ /**
+ * @var string
+ */
+ public $type_label;
+
+ /**
+ * @var int
+ */
+ public $bank_account;
+
+ /**
+ * @var int
+ */
+ public $bank_line;
+
/**
* @var integer|string paiementtype
*/
diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php
index c888f438f54..3ff2b6178e7 100644
--- a/htdocs/compta/tva/class/tva.class.php
+++ b/htdocs/compta/tva/class/tva.class.php
@@ -62,6 +62,26 @@ class Tva extends CommonObject
public $type_payment;
public $num_payment;
+ /**
+ * @var DateTime
+ */
+ public $datec;
+
+ /**
+ * @var int ID
+ */
+ public $fk_type;
+
+ /**
+ * @var int
+ */
+ public $paye;
+
+ /**
+ * @var int
+ */
+ public $rappro;
+
/**
* @var integer|string totalpaid
*/
diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php
index 7540dbe8ef3..c1e9c9afeae 100644
--- a/htdocs/core/class/commoninvoice.class.php
+++ b/htdocs/core/class/commoninvoice.class.php
@@ -100,6 +100,34 @@ abstract class CommonInvoice extends CommonObject
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
+ /**
+ * @var int
+ */
+ public $stripechargedone;
+
+ /**
+ * @var int
+ */
+ public $stripechargeerror;
+
+ /**
+ * Payment description
+ * @var string
+ */
+ public $description;
+
+ /**
+ * @var string
+ * @deprecated
+ * @see $ref_customer
+ */
+ public $ref_client;
+
+ /**
+ * @var int Situation cycle reference number
+ */
+ public $situation_cycle_ref;
+
/**
* ! Closing after partial payment: discount_vat, badsupplier, abandon
* ! Closing when no payment: replaced, abandoned
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index fe0560d0da4..62b72c81579 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -9627,7 +9627,8 @@ function picto_from_langcode($codelang, $moreatt = '', $notitlealt = 0)
$flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1];
}
- return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt, 0, $notitlealt);
+ // return img_picto_common($codelang, 'flags/'.strtolower($flagImage).'.png', $moreatt, 0, $notitlealt);
+ return ' ';
}
/**
diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php
index 394a341aa7f..f3fd9188972 100644
--- a/htdocs/core/lib/functions2.lib.php
+++ b/htdocs/core/lib/functions2.lib.php
@@ -2880,10 +2880,12 @@ function acceptLocalLinktoMedia()
}
//var_dump($iptocheck.' '.$acceptlocallinktomedia);
- if (!filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
+ $allowParamName = 'MAIN_ALLOW_WYSIWYG_LOCAL_MEDIAS_ON_PRIVATE_NETWORK';
+ $allowPrivateNetworkIP = getDolGlobalInt($allowParamName);
+ if (!$allowPrivateNetworkIP && !filter_var($iptocheck, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
// If ip of public url is a private network IP, we do not allow this.
$acceptlocallinktomedia = 0;
- // TODO Show a warning
+ setEventMessage("WYSIWYG Editor : local media not allowed (checked IP: {$iptocheck}). Use {$allowParamName} = 1 to allow local network ip", 'warnings');
}
if (preg_match('/http:/i', $urlwithouturlroot)) {
diff --git a/htdocs/fourn/facture/card-rec.php b/htdocs/fourn/facture/card-rec.php
index 558574b3a0a..b58434d6291 100644
--- a/htdocs/fourn/facture/card-rec.php
+++ b/htdocs/fourn/facture/card-rec.php
@@ -1025,6 +1025,8 @@ if ($action == 'create') {
$title = $langs->trans("Recurrence");
print load_fiche_titre(img_picto('', 'recurring', 'class="pictofixedwidth"') . $title, '', '');
+ print ''.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name')).' ';
+
print dol_get_fiche_head(null, '', '', 0);
print '';
@@ -1053,7 +1055,7 @@ if ($action == 'create') {
// Auto generate document
if (!empty($conf->global->INVOICE_REC_CAN_DISABLE_DOCUMENT_FILE_GENERATION)) {
- print "" . $langs->trans("StatusOfGeneratedDocuments") . " ";
+ print " " . $langs->trans("StatusOfAutoGeneratedDocuments") . " ";
$select = array('0' => $langs->trans('DoNotGenerateDoc'), '1' => $langs->trans('AutoGenerateDoc'));
print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf'));
print " ";
diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang
index 8d44904d58b..e933fb21b93 100644
--- a/htdocs/langs/en_US/bills.lang
+++ b/htdocs/langs/en_US/bills.lang
@@ -124,7 +124,7 @@ EnterPaymentDueToCustomer=Make payment due to customer
DisabledBecauseRemainderToPayIsZero=Disabled because remaining unpaid is zero
PriceBase=Base price
BillStatus=Invoice status
-StatusOfGeneratedInvoices=Status of generated invoices
+StatusOfAutoGeneratedInvoices=Status of automatically generated invoices
BillStatusDraft=Draft (needs to be validated)
BillStatusPaid=Paid
BillStatusPaidBackOrConverted=Credit note refund or marked as credit available
@@ -642,4 +642,4 @@ MentionCategoryOfOperations0=Delivery of goods
MentionCategoryOfOperations1=Provision of services
MentionCategoryOfOperations2=Mixed - Delivery of goods & provision of services
Salaries=Salaries
-InvoiceSubtype=Invoice Subtype
\ No newline at end of file
+InvoiceSubtype=Invoice Subtype
diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang
index 277081d7ef3..3829a265546 100644
--- a/htdocs/langs/en_US/members.lang
+++ b/htdocs/langs/en_US/members.lang
@@ -241,3 +241,5 @@ MemberFirstname=Member firstname
MemberLastname=Member lastname
MemberCodeDesc=Member Code, unique for all members
NoRecordedMembers=No recorded members
+MemberSubscriptionStartFirstDayOf=The start date of a membership corresponds to the first day of a
+MemberSubscriptionStartAfter=Minimum period before the entry into force of the start date of a subscription except renewals (example +3m = +3 months, -5d = -3 days, +1Y = +1 year) (example: +3m = +3 months, -5d = -3 days, +1Y = +1 year)
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/members.lang b/htdocs/langs/fr_FR/members.lang
index cb6f3168277..905e2efe8f6 100644
--- a/htdocs/langs/fr_FR/members.lang
+++ b/htdocs/langs/fr_FR/members.lang
@@ -241,3 +241,5 @@ MemberFirstname=Prénom du membre
MemberLastname=Nom de famille du membre
MemberCodeDesc=Code membre, unique pour tous les membres
NoRecordedMembers=Aucun membre enregistré
+MemberSubscriptionStartFirstDayOf=La date de début d'une adhésion correspond au premier jour d'un(e)
+MemberSubscriptionStartAfter=Délai minimum avant l'entrée en vigueur de la date de début d'une souscription hors renouvellement (exemple +3m = +3 mois, -5d = -3 jours, +1Y = +1 année)
\ No newline at end of file
diff --git a/htdocs/product/stock/stockatdate.php b/htdocs/product/stock/stockatdate.php
index 868b3bb3adf..ddee7143569 100644
--- a/htdocs/product/stock/stockatdate.php
+++ b/htdocs/product/stock/stockatdate.php
@@ -276,10 +276,10 @@ $sql = 'SELECT p.rowid, p.ref, p.label, p.description, p.price, p.pmp,';
$sql .= ' p.price_ttc, p.price_base_type, p.fk_product_type, p.desiredstock, p.seuil_stock_alerte,';
$sql .= ' p.tms as datem, p.duration, p.tobuy, p.stock, ';
if (!empty($search_fk_warehouse)) {
- $sql .= " SUM(p.pmp * ps.reel) as estimatedvalue, SUM(p.price * ps.reel) as sellvalue";
+ $sql .= " SUM(p.pmp * ps.reel) as currentvalue, SUM(p.price * ps.reel) as sellvalue";
$sql .= ', SUM(ps.reel) as stock_reel';
} else {
- $sql .= " SUM(p.pmp * p.stock) as estimatedvalue, SUM(p.price * p.stock) as sellvalue";
+ $sql .= " SUM(p.pmp * p.stock) as currentvalue, SUM(p.price * p.stock) as sellvalue";
}
// Add fields from hooks
$parameters = array();
@@ -611,12 +611,13 @@ while ($i < ($limit ? min($num, $limit) : $num)) {
// PMP value
print '';
- if (price2num($stock * $objp->pmp, 'MT')) {
- print ''.price(price2num($stock * $objp->pmp, 'MT'), 1).' ';
+ $estimatedvalue = $stock * $objp->pmp;
+ if (price2num($estimatedvalue, 'MT')) {
+ print ''.price(price2num($estimatedvalue, 'MT'), 1).' ';
} else {
print '';
}
- $totalbuyingprice += $stock * $objp->pmp;
+ $totalbuyingprice += $estimatedvalue;
print ' ';
// Selling value
diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php
index 6135c1e6801..57f00ea09f1 100644
--- a/htdocs/public/payment/paymentok.php
+++ b/htdocs/public/payment/paymentok.php
@@ -2,7 +2,7 @@
/* Copyright (C) 2001-2002 Rodolphe Quiedeville
* Copyright (C) 2006-2013 Laurent Destailleur
* Copyright (C) 2012 Regis Houssin
- * Copyright (C) 2021 Waël Almoman
+ * Copyright (C) 2021-2023 Waël Almoman
* Copyright (C) 2021 Maxime Demarest
* Copyright (C) 2021 Dorian Vabre
*
@@ -522,9 +522,17 @@ if ($ispaymentok) {
}
// Subscription informations
- $datesubscription = $object->datevalid;
+ $datesubscription = $object->datevalid; // By default, the subscription start date is the payment date
if ($object->datefin > 0) {
$datesubscription = dol_time_plus_duree($object->datefin, 1, 'd');
+ } elseif (getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER')) {
+ $datesubscription = dol_time_plus_duree($now, (int) substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), 0, -1), substr(getDolGlobalString('MEMBER_SUBSCRIPTION_START_AFTER'), -1));
+ }
+
+ if (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "m") {
+ $datesubscription = dol_get_first_day(dol_print_date($datesubscription, "%Y"), dol_print_date($datesubscription, "%m"));
+ } elseif (getDolGlobalString('MEMBER_SUBSCRIPTION_START_FIRST_DAY_OF') === "Y") {
+ $datesubscription = dol_get_first_day(dol_print_date($datesubscription, "%Y"));
}
$datesubend = null;
diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php
index 335965e385a..3e379db1f93 100644
--- a/htdocs/societe/card.php
+++ b/htdocs/societe/card.php
@@ -1208,572 +1208,578 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
print dol_get_fiche_head(null, 'card', '', 0, '');
- print '';
+ // Call Hook tabContentCreateThirdparty
+ $parameters = array();
+ // Note that $action and $object may be modified by hook
+ $reshook = $hookmanager->executeHooks('tabContentCreateThirdparty', $parameters, $object, $action);
+ if (empty($reshook)) {
+ print '';
- // Name, firstname
- print '';
- if ($object->particulier || $private) {
- print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').' ';
- } else {
- print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).' ';
- }
- print ' global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>';
+ // Name, firstname
+ print ' ';
+ if ($object->particulier || $private) {
+ print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').' ';
+ } else {
+ print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).' ';
+ }
+ print ' global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>';
- print ' ';
- print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300'); // For some countries that need the company name in 2 languages
- // This implementation of the feature to search already existing company has been disabled. It must be implemented by keeping the "input text" and we must call the search ajax societe/ajax/ajaxcompanies.php
- // on a keydown of the input. We should show data about a duplicate found if we found less than 5 answers into a div under the input.
- /*
- print ' ';
- print "\n".'
- ';
- */
- print ' ';
- if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
- print ''.$langs->trans('Prefix').' ';
- }
- print ' ';
-
- // If javascript on, we show option individual
- if ($conf->use_javascript_ajax) {
- if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) {
- // Firstname
- print ''.$form->editfieldkey('FirstName', 'firstname', '', $object, 0).' ';
- print ' ';
- print ' ';
-
- // Title
- print ''.$form->editfieldkey('UserTitle', 'civility_id', '', $object, 0).' ';
- print $formcompany->select_civility($object->civility_id, 'civility_id', 'maxwidth100').' ';
- print ' ';
- }
- }
-
- // Alias names (commercial, trademark or alias names)
- print ''.$langs->trans('AliasNames').' ';
- print ' ';
-
- // Prospect/Customer
- print ''.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).' ';
- print '';
- $selected = (GETPOSTISSET('client') ?GETPOST('client', 'int') : $object->client);
- print $formcompany->selectProspectCustomerType($selected);
- print ' ';
-
- if ($conf->browser->layout == 'phone') {
- print '';
- }
-
- print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).' ';
- print '';
- print ' ';
-
- if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))
- || (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire'))) {
- // Supplier
- print '';
- print ''.$form->editfieldkey('Vendor', 'fournisseur', '', $object, 0, 'string', '', 1).' ';
- $default = -1;
- if (!empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) {
- $default = 1;
- }
- print $form->selectyesno("fournisseur", (GETPOST('fournisseur', 'int') != '' ? GETPOST('fournisseur', 'int') : (GETPOST("type", 'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type", 'alpha') == '' ? 1 : 0), 1);
+
+ ';
+ */
print ' ';
+ if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
+ print ''.$langs->trans('Prefix').' ';
+ }
+ print ' ';
+ // If javascript on, we show option individual
+ if ($conf->use_javascript_ajax) {
+ if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) {
+ // Firstname
+ print ''.$form->editfieldkey('FirstName', 'firstname', '', $object, 0).' ';
+ print ' ';
+ print ' ';
+
+ // Title
+ print ''.$form->editfieldkey('UserTitle', 'civility_id', '', $object, 0).' ';
+ print $formcompany->select_civility($object->civility_id, 'civility_id', 'maxwidth100').' ';
+ print ' ';
+ }
+ }
+
+ // Alias names (commercial, trademark or alias names)
+ print ''.$langs->trans('AliasNames').' ';
+ print ' ';
+
+ // Prospect/Customer
+ print ''.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).' ';
+ print '';
+ $selected = (GETPOSTISSET('client') ?GETPOST('client', 'int') : $object->client);
+ print $formcompany->selectProspectCustomerType($selected);
+ print ' ';
if ($conf->browser->layout == 'phone') {
print '';
}
- print '';
- if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
- print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0);
+ print ' '.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).' ';
+ print '';
+ $tmpcode = $object->code_client;
+ if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
+ $tmpcode = $modCodeClient->getNextValue($object, 0);
}
+ print ' ';
print ' ';
- if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
- print '';
- $tmpcode = $object->code_fournisseur;
- if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
- $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
+ $s = $modCodeClient->getToolTip($langs, $object, 0);
+ print $form->textwithpicto('', $s, 1);
+ print '
';
+ print ' ';
+
+ if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))
+ || (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire'))) {
+ // Supplier
+ print '';
+ print ''.$form->editfieldkey('Vendor', 'fournisseur', '', $object, 0, 'string', '', 1).' ';
+ $default = -1;
+ if (!empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)) {
+ $default = 1;
+ }
+ print $form->selectyesno("fournisseur", (GETPOST('fournisseur', 'int') != '' ? GETPOST('fournisseur', 'int') : (GETPOST("type", 'alpha') == '' ? $default : $object->fournisseur)), 1, 0, (GETPOST("type", 'alpha') == '' ? 1 : 0), 1);
+ print ' ';
+
+
+ if ($conf->browser->layout == 'phone') {
+ print ' ';
+ }
+
+ print '';
+ if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
+ print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0);
}
- print ' ';
print ' ';
- $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
- print $form->textwithpicto('', $s, 1);
- print '
';
+ if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
+ print '';
+ }
+ print ' ';
}
+
+ // Status
+ print ''.$form->editfieldkey('Status', 'status', '', $object, 0).' ';
+ print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1);
print ' ';
- }
- // Status
- print ''.$form->editfieldkey('Status', 'status', '', $object, 0).' ';
- print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), 1, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1);
- print ' ';
+ // Barcode
+ if (isModEnabled('barcode')) {
+ print ''.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).' ';
+ print '';
+ print img_picto('', 'barcode', 'class="pictofixedwidth"');
+ print ' ';
+ print ' ';
+ }
- // Barcode
- if (isModEnabled('barcode')) {
- print ''.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).' ';
+ // Address
+ print '';
+ print $form->editfieldkey('Address', 'address', '', $object, 0);
+ print ' ';
print '';
- print img_picto('', 'barcode', 'class="pictofixedwidth"');
- print ' ';
+ print '';
+ print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent');
print ' ';
- }
- // Address
- print '';
- print $form->editfieldkey('Address', 'address', '', $object, 0);
- print ' ';
- print '';
- print '';
- print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent');
- print ' ';
+ // Zip / Town
+ print ''.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).' ';
+ print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100');
+ print ' ';
+ if ($conf->browser->layout == 'phone') {
+ print '';
+ }
+ print ''.$form->editfieldkey('Town', 'town', '', $object, 0).' ';
+ print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth150 quatrevingtpercent');
+ print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent');
+ print ' ';
- // Zip / Town
- print ''.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).' ';
- print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100');
- print ' ';
- if ($conf->browser->layout == 'phone') {
- print '';
- }
- print ''.$form->editfieldkey('Town', 'town', '', $object, 0).' ';
- print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth150 quatrevingtpercent');
- print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent');
- print ' ';
+ // Country
+ print ''.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).' ';
+ print img_picto('', 'country', 'class="pictofixedwidth"');
+ print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 maxwidth500 widthcentpercentminusx');
+ if ($user->admin) {
+ print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ }
+ print ' ';
- // Country
- print ''.$form->editfieldkey('Country', 'selectcountry_id', '', $object, 0).' ';
- print img_picto('', 'country', 'class="pictofixedwidth"');
- print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 maxwidth500 widthcentpercentminusx');
- if ($user->admin) {
- print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
- }
- print ' ';
+ // State
+ if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
+ if ((getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) {
+ print ''.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).' ';
+ } else {
+ print ' '.$form->editfieldkey('State', 'state_id', '', $object, 0).' ';
+ }
- // State
- if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
- if ((getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) {
- print ' '.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).' ';
- } else {
- print ' '.$form->editfieldkey('State', 'state_id', '', $object, 0).' ';
+ if ($object->country_id) {
+ print img_picto('', 'state', 'class="pictofixedwidth"');
+ print $formcompany->select_state($object->state_id, $object->country_code);
+ } else {
+ print $countrynotdefined;
+ }
+ print ' ';
}
+ // Phone / Fax
+ print ''.$form->editfieldkey('Phone', 'phone', '', $object, 0).' ';
+ print 'browser->layout == 'phone' ? ' colspan="3"' : '').'>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' ';
+ if ($conf->browser->layout == 'phone') {
+ print '';
+ }
+ print ''.$form->editfieldkey('Fax', 'fax', '', $object, 0).' ';
+ print 'browser->layout == 'phone' ? ' colspan="3"' : '').'>'.img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"').' ';
+
+ // Email / Web
+ print ''.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', empty($conf->global->SOCIETE_EMAIL_MANDATORY) ? '' : $conf->global->SOCIETE_EMAIL_MANDATORY).' ';
+ print 'browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.img_picto('', 'object_email', 'class="pictofixedwidth"').' ';
+ if (isModEnabled('mailing') && !empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) {
+ if ($conf->browser->layout == 'phone') {
+ print '';
+ }
+ print ''.$form->editfieldkey($langs->trans('No_Email') .' ('.$langs->trans('Contact').')', 'contact_no_email', '', $object, 0).' ';
+ print 'browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.$form->selectyesno('contact_no_email', (GETPOSTISSET("contact_no_email") ? GETPOST("contact_no_email", 'alpha') : (empty($object->no_email) ? 0 : 1)), 1, false, 1).' ';
+ }
+ print ' ';
+ print ''.$form->editfieldkey('Web', 'url', '', $object, 0).' ';
+ print ''.img_picto('', 'globe', 'class="pictofixedwidth"').' ';
+
+ // Unsubscribe
+ if (isModEnabled('mailing')) {
+ if ($conf->use_javascript_ajax && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
+ print "\n".''."\n";
+ }
+ if (!GETPOSTISSET("no_email") && !empty($object->email)) {
+ $result = $object->getNoEmail();
+ if ($result < 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+ print '';
+ print ''.$langs->trans("No_Email").' ';
+ print '';
+ print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS')), 1, false, (getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2));
+ print ' ';
+ print ' ';
+ }
+
+ // Social networks
+ if (isModEnabled('socialnetworks')) {
+ $object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4));
+ }
+
+ // Prof ids
+ $i = 1; $j = 0; $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2);
+ while ($i <= 6) {
+ $idprof = $langs->transcountry('ProfId'.$i, $object->country_code);
+ if ($idprof != '-') {
+ $key = 'idprof'.$i;
+
+ if (($j % $NBCOLS) == 0) {
+ print '';
+ }
+
+ $idprof_mandatory = 'SOCIETE_IDPROF'.($i).'_MANDATORY';
+ print ''.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', (empty($conf->global->$idprof_mandatory) ? 0 : 1)).' ';
+
+ print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code);
+ print ' ';
+ if (($j % $NBCOLS) == ($NBCOLS - 1)) {
+ print ' ';
+ }
+ $j++;
+ }
+ $i++;
+ }
+ if ($NBCOLS > 1 && ($j % 2 == 1)) {
+ print ' ';
+ }
+
+ // Vat is used
+ print ''.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).' ';
+ print '';
+ print ' '; // Assujeti par defaut en creation
+ print ' ';
+ if ($conf->browser->layout == 'phone') {
+ print '';
+ }
+ print ''.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).' ';
+ print '';
+ $s = ' ';
+
+ if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) {
+ $s .= ' ';
+
+ if (!empty($conf->use_javascript_ajax)) {
+ $widthpopup = 600;
+ if (!empty($conf->dol_use_jmobile)) {
+ $widthpopup = 350;
+ }
+ $heightpopup = 400;
+ print "\n";
+ print '';
+ print "\n";
+ $s .= ''.$langs->trans("VATIntraCheck").' ';
+ $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1);
+ } else {
+ $s .= 'country_id).'" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').' ';
+ }
+ }
+ print $s;
+ print ' ';
+ print ' ';
+
+ // VAT reverse charge by default
+ if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
+ print '' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . ' ';
+ print ' vat_reverse_charge == '1' ? ' checked' : '').'>';
+ print ' ';
+ }
+
+ // Local Taxes
+ //TODO: Place into a function to control showing by country or study better option
+ if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
+ print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).' ';
+ print ' global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">';
+ print ' ';
+ if ($conf->browser->layout == 'phone') {
+ print '';
+ }
+ print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).' ';
+ print ' global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">';
+ print ' ';
+ } elseif ($mysoc->localtax1_assuj == "1") {
+ print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).' ';
+ print ' global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">';
+ print ' ';
+ } elseif ($mysoc->localtax2_assuj == "1") {
+ print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).' ';
+ print ' global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">';
+ print ' ';
+ }
+
+ // Type - Workforce/Staff
+ print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).' browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'."\n";
+ $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
+ print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1);
+ if ($user->admin) {
+ print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ }
+ if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) {
+ print ' ';
+ if ($conf->browser->layout == 'phone') {
+ print '';
+ }
+ print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).' browser->layout == 'phone' ? ' colspan="3"' : '').'>';
+ print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1);
+ if ($user->admin) {
+ print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ }
+ } else {
+ print ' ';
+ }
+ print ' ';
+
+ // Legal Form
+ print ''.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).' ';
+ print '';
if ($object->country_id) {
- print img_picto('', 'state', 'class="pictofixedwidth"');
- print $formcompany->select_state($object->state_id, $object->country_code);
+ print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code');
} else {
print $countrynotdefined;
}
print ' ';
- }
- // Phone / Fax
- print ''.$form->editfieldkey('Phone', 'phone', '', $object, 0).' ';
- print 'browser->layout == 'phone' ? ' colspan="3"' : '').'>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' ';
- if ($conf->browser->layout == 'phone') {
- print '';
- }
- print ''.$form->editfieldkey('Fax', 'fax', '', $object, 0).' ';
- print 'browser->layout == 'phone' ? ' colspan="3"' : '').'>'.img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"').' ';
-
- // Email / Web
- print ''.$form->editfieldkey('EMail', 'email', '', $object, 0, 'string', '', empty($conf->global->SOCIETE_EMAIL_MANDATORY) ? '' : $conf->global->SOCIETE_EMAIL_MANDATORY).' ';
- print 'browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.img_picto('', 'object_email', 'class="pictofixedwidth"').' ';
- if (isModEnabled('mailing') && !empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) {
- if ($conf->browser->layout == 'phone') {
- print '';
- }
- print ''.$form->editfieldkey($langs->trans('No_Email') .' ('.$langs->trans('Contact').')', 'contact_no_email', '', $object, 0).' ';
- print 'browser->layout == 'phone') || !isModEnabled('mailing') ? ' colspan="3"' : '').'>'.$form->selectyesno('contact_no_email', (GETPOSTISSET("contact_no_email") ? GETPOST("contact_no_email", 'alpha') : (empty($object->no_email) ? 0 : 1)), 1, false, 1).' ';
- }
- print ' ';
- print ''.$form->editfieldkey('Web', 'url', '', $object, 0).' ';
- print ''.img_picto('', 'globe', 'class="pictofixedwidth"').' ';
-
- // Unsubscribe
- if (isModEnabled('mailing')) {
- if ($conf->use_javascript_ajax && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
- print "\n".''."\n";
- }
- if (!GETPOSTISSET("no_email") && !empty($object->email)) {
- $result = $object->getNoEmail();
- if ($result < 0) {
- setEventMessages($object->error, $object->errors, 'errors');
- }
- }
- print '';
- print ''.$langs->trans("No_Email").' ';
- print '';
- print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS')), 1, false, (getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2));
- print ' ';
- print ' ';
- }
-
- // Social networks
- if (isModEnabled('socialnetworks')) {
- $object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4));
- }
-
- // Prof ids
- $i = 1; $j = 0; $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2);
- while ($i <= 6) {
- $idprof = $langs->transcountry('ProfId'.$i, $object->country_code);
- if ($idprof != '-') {
- $key = 'idprof'.$i;
-
- if (($j % $NBCOLS) == 0) {
- print '';
- }
-
- $idprof_mandatory = 'SOCIETE_IDPROF'.($i).'_MANDATORY';
- print ''.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', (empty($conf->global->$idprof_mandatory) ? 0 : 1)).' ';
-
- print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code);
- print ' ';
- if (($j % $NBCOLS) == ($NBCOLS - 1)) {
- print ' ';
- }
- $j++;
- }
- $i++;
- }
- if ($NBCOLS > 1 && ($j % 2 == 1)) {
- print ' ';
- }
-
- // Vat is used
- print ''.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).' ';
- print '';
- print ' '; // Assujeti par defaut en creation
- print ' ';
- if ($conf->browser->layout == 'phone') {
- print '';
- }
- print ''.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).' ';
- print '';
- $s = ' ';
-
- if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) {
- $s .= ' ';
-
- if (!empty($conf->use_javascript_ajax)) {
- $widthpopup = 600;
- if (!empty($conf->dol_use_jmobile)) {
- $widthpopup = 350;
- }
- $heightpopup = 400;
- print "\n";
- print '';
- print "\n";
- $s .= ''.$langs->trans("VATIntraCheck").' ';
- $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1);
+ // Capital
+ print ' '.$form->editfieldkey('Capital', 'capital', '', $object, 0).' ';
+ print ' ';
+ if (isModEnabled("multicurrency")) {
+ print ''.$langs->trans("Currency".$object->multicurrency_code).' ';
} else {
- $s .= 'country_id).'" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').' ';
+ print ''.$langs->trans("Currency".$conf->currency).' ';
}
- }
- print $s;
- print '';
- print '';
-
- // VAT reverse charge by default
- if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
- print '' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . ' ';
- print ' vat_reverse_charge == '1' ? ' checked' : '').'>';
- print ' ';
- }
-
- // Local Taxes
- //TODO: Place into a function to control showing by country or study better option
- if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
- print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).' ';
- print ' global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">';
- print ' ';
- if ($conf->browser->layout == 'phone') {
- print '';
+ if (getDolGlobalInt('MAIN_MULTILANGS')) {
+ print ' '.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).' '."\n";
+ print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
+ print ' ';
+ print ' ';
}
- print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).' ';
- print ' global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">';
- print ' ';
- } elseif ($mysoc->localtax1_assuj == "1") {
- print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).' ';
- print ' global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? 'checked="checked"' : '') . ' value="1">';
- print ' ';
- } elseif ($mysoc->localtax2_assuj == "1") {
- print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).' ';
- print ' global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? 'checked="checked"' : '') . ' value="1">';
- print ' ';
- }
- // Type - Workforce/Staff
- print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).' browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>'."\n";
- $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label.
- print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, $sortparam, '', 1);
- if ($user->admin) {
- print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
- }
- if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) {
- print ' ';
- if ($conf->browser->layout == 'phone') {
- print '';
+ // Incoterms
+ if (isModEnabled('incoterm')) {
+ print ' ';
+ print ''.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).' ';
+ print '';
+ print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''));
+ print ' ';
}
- print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).' browser->layout == 'phone' ? ' colspan="3"' : '').'>';
- print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1);
- if ($user->admin) {
- print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+
+ // Categories
+ if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
+ $langs->load('categories');
+
+ // Customer
+ print ' '.$form->editfieldkey('CustomersProspectsCategoriesShort', 'custcats', '', $object, 0).' ';
+ $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1);
+ print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
+ print " ";
+
+ if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) {
+ print ''.$form->editfieldkey('ContactCategoriesShort', 'contcats', '', $object, 0).' ';
+ $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1);
+ print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
+ print " ";
+ }
+
+ // Supplier
+ if (isModEnabled("supplier_proposal") || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
+ print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).' ';
+ $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1);
+ print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
+ print " ";
+ }
}
- } else {
- print ' ';
- }
- print '';
- // Legal Form
- print ''.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).' ';
- print '';
- if ($object->country_id) {
- print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code');
- } else {
- print $countrynotdefined;
- }
- print ' ';
+ // Multicurrency
+ if (isModEnabled("multicurrency")) {
+ print '';
+ print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).' ';
+ print '';
+ print img_picto('', 'currency', 'class="pictofixedwidth"');
+ print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code') : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)), 'multicurrency_code', 1, '', false, 'maxwidth150 widthcentpercentminusx');
+ print ' ';
+ }
- // Capital
- print ''.$form->editfieldkey('Capital', 'capital', '', $object, 0).' ';
- print ' ';
- if (isModEnabled("multicurrency")) {
- print ''.$langs->trans("Currency".$object->multicurrency_code).' ';
- } else {
- print ''.$langs->trans("Currency".$conf->currency).' ';
- }
- if (getDolGlobalInt('MAIN_MULTILANGS')) {
- print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).' '."\n";
- print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language(GETPOST('default_lang', 'alpha') ? GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone');
+ // Other attributes
+ $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
+
+ // Parent company
+ if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) {
+ print ' ';
+ print ''.$langs->trans('ParentCompany').' ';
+ print '';
+ print img_picto('', 'company', 'class="paddingrightonly"');
+ print $form->select_company(GETPOST('parent_company_id'), 'parent_company_id', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
+ print ' ';
+ }
+
+ // Assign a sale representative
+ print '';
+ print ''.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).' ';
+ print '';
+ $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', '0', 0, 0, 'AND u.statut = 1', 0, '', '', 0, 2);
+ // Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record.
+ $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir) ? array($user->id) : array())));
+ print img_picto('', 'user').$form->multiselectarray('commercial', $userlist, $selected, null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
+ print ' ';
+
+ // Add logo
+ print '';
+ print ''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).' ';
+ print '';
+ print ' ';
print ' ';
print ' ';
- }
- // Incoterms
- if (isModEnabled('incoterm')) {
- print '';
- print ''.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).' ';
- print '';
- print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''));
- print ' ';
- }
+ print '
'."\n";
- // Categories
- if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
- $langs->load('categories');
+ // Accountancy codes
+ if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
+ print '';
- // Customer
- print ''.$form->editfieldkey('CustomersProspectsCategoriesShort', 'custcats', '', $object, 0).' ';
- $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1);
- print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
- print " ";
+ if (isModEnabled('accounting')) {
+ // Accountancy_code_sell
+ print ''.$langs->trans("ProductAccountancySellCode").' ';
+ print '';
+ $accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
+ print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, '');
+ print ' ';
- if (!empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) {
- print ''.$form->editfieldkey('ContactCategoriesShort', 'contcats', '', $object, 0).' ';
- $cate_arbo = $form->select_all_categories(Categorie::TYPE_CONTACT, null, 'parent', null, null, 1);
- print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('contcats', $cate_arbo, GETPOST('contcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
- print " ";
+ // Accountancy_code_buy
+ print ''.$langs->trans("ProductAccountancyBuyCode").' ';
+ print '';
+ $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
+ print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, '');
+ print ' ';
+ } else { // For external software
+ // Accountancy_code_sell
+ print ''.$langs->trans("ProductAccountancySellCode").' ';
+ print ' ';
+ print ' ';
+
+ // Accountancy_code_buy
+ print ''.$langs->trans("ProductAccountancyBuyCode").' ';
+ print ' ';
+ print ' ';
+ }
+
+ print '
';
}
-
- // Supplier
- if (isModEnabled("supplier_proposal") || isModEnabled("supplier_order") || isModEnabled("supplier_invoice")) {
- print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).' ';
- $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1);
- print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
- print " ";
- }
- }
-
- // Multicurrency
- if (isModEnabled("multicurrency")) {
- print '';
- print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).' ';
- print '';
- print img_picto('', 'currency', 'class="pictofixedwidth"');
- print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code') : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)), 'multicurrency_code', 1, '', false, 'maxwidth150 widthcentpercentminusx');
- print ' ';
- }
-
- // Other attributes
- $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
-
- // Parent company
- if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) {
- print '';
- print ''.$langs->trans('ParentCompany').' ';
- print '';
- print img_picto('', 'company', 'class="paddingrightonly"');
- print $form->select_company(GETPOST('parent_company_id'), 'parent_company_id', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
- print ' ';
- }
-
- // Assign a sale representative
- print '';
- print ''.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).' ';
- print '';
- $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', '0', 0, 0, 'AND u.statut = 1', 0, '', '', 0, 2);
- // Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record.
- $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir) ? array($user->id) : array())));
- print img_picto('', 'user').$form->multiselectarray('commercial', $userlist, $selected, null, null, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
- print ' ';
-
- // Add logo
- print '';
- print ''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).' ';
- print '';
- print ' ';
- print ' ';
- print ' ';
-
- print '
'."\n";
-
- // Accountancy codes
- if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
- print '';
-
- if (isModEnabled('accounting')) {
- // Accountancy_code_sell
- print ''.$langs->trans("ProductAccountancySellCode").' ';
- print '';
- $accountancy_code_sell = GETPOST('accountancy_code_sell', 'alpha');
- print $formaccounting->select_account($accountancy_code_sell, 'accountancy_code_sell', 1, null, 1, 1, '');
- print ' ';
-
- // Accountancy_code_buy
- print ''.$langs->trans("ProductAccountancyBuyCode").' ';
- print '';
- $accountancy_code_buy = GETPOST('accountancy_code_buy', 'alpha');
- print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, '');
- print ' ';
- } else { // For external software
- // Accountancy_code_sell
- print ''.$langs->trans("ProductAccountancySellCode").' ';
- print ' ';
- print ' ';
-
- // Accountancy_code_buy
- print ''.$langs->trans("ProductAccountancyBuyCode").' ';
- print ' ';
- print ' ';
- }
-
- print '
';
}
print dol_get_fiche_end();
@@ -2026,532 +2032,538 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
print dol_get_fiche_head($head, 'card', $langs->trans("ThirdParty"), 0, 'company');
print '';
- print '
';
+ // Call Hook tabContentEditThirdparty
+ $parameters = array();
+ // Note that $action and $object may be modified by hook
+ $reshook = $hookmanager->executeHooks('tabContentEditThirdparty', $parameters, $object, $action);
+ if (empty($reshook)) {
+ print '';
- // Ref/ID
- if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
- print ''.$langs->trans("ID").' ';
- print $object->ref;
+ // Ref/ID
+ if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) {
+ print ' '.$langs->trans("ID").' ';
+ print $object->ref;
+ print ' ';
+ }
+
+ // Name
+ print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0, 'string', '', 1).' ';
+ print ' ';
+ print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300');
print ' ';
- }
- // Name
- print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0, 'string', '', 1).' ';
- print ' ';
- print $form->widgetForTranslation("name", $object, $permissiontoadd, 'string', 'alpahnohtml', 'minwidth300');
- print ' ';
+ // Alias names (commercial, trademark or alias names)
+ print ''.$langs->trans('AliasNames').' ';
+ print ' ';
- // Alias names (commercial, trademark or alias names)
- print ''.$langs->trans('AliasNames').' ';
- print ' ';
-
- // Prefix
- if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
- print ''.$form->editfieldkey('Prefix', 'prefix', '', $object, 0).' ';
- // It does not change the prefix mode using the auto numbering prefix
- if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm) {
- print ' ';
- print $object->prefix_comm;
- } else {
- print ' ';
+ // Prefix
+ if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
+ print ' '.$form->editfieldkey('Prefix', 'prefix', '', $object, 0).' ';
+ // It does not change the prefix mode using the auto numbering prefix
+ if (($prefixCustomerIsUsed || $prefixSupplierIsUsed) && $object->prefix_comm) {
+ print ' ';
+ print $object->prefix_comm;
+ } else {
+ print ' ';
+ }
+ print ' ';
}
- print '';
- }
- // Prospect/Customer
- print ''.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).' ';
- print '';
- print $formcompany->selectProspectCustomerType($object->client);
- print ' ';
- if ($conf->browser->layout == 'phone') {
- print '';
- }
- print ''.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).' ';
-
- print '';
-
- print ' ';
-
- // Supplier
- if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire')))
- || (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire'))) {
- print '';
- print ''.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).' ';
+ // Prospect/Customer
+ print ' '.$form->editfieldkey('ProspectCustomer', 'customerprospect', '', $object, 0, 'string', '', 1).' ';
print '';
- print $form->selectyesno("fournisseur", $object->fournisseur, 1, false, 0, 1);
+ print $formcompany->selectProspectCustomerType($object->client);
print ' ';
if ($conf->browser->layout == 'phone') {
print '';
}
- print '';
- if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
- print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0);
- }
- print ' ';
- print '';
+ print ' '.$form->editfieldkey('CustomerCode', 'customer_code', '', $object, 0).' ';
+
print '';
- if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) {
- $tmpcode = $object->code_fournisseur;
- if (empty($tmpcode) && !empty($object->oldcopy->code_fournisseur)) {
- $tmpcode = $object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value.
+ if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) {
+ $tmpcode = $object->code_client;
+ if (empty($tmpcode) && !empty($object->oldcopy->code_client)) {
+ $tmpcode = $object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value.
}
- if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) {
- $tmpcode = $modCodeFournisseur->getNextValue($object, 1);
+ if (empty($tmpcode) && !empty($modCodeClient->code_auto)) {
+ $tmpcode = $modCodeClient->getNextValue($object, 0);
}
- print ' ';
- } elseif ($object->codefournisseur_modifiable()) {
- print ' ';
+ print ' ';
+ } elseif ($object->codeclient_modifiable()) {
+ print ' ';
} else {
- print $object->code_fournisseur;
- print ' ';
+ print $object->code_client;
+ print ' ';
}
print ' ';
- $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
+ $s = $modCodeClient->getToolTip($langs, $object, 0);
print $form->textwithpicto('', $s, 1);
print '
';
+
print ' ';
- }
- // Barcode
- if (isModEnabled('barcode')) {
- print ''.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).' ';
- print '';
- print img_picto('', 'barcode');
- print ' ';
- print ' ';
- }
-
- // Status
- print ''.$form->editfieldkey('Status', 'status', '', $object, 0).' ';
- print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1);
- print ' ';
-
- // Address
- print ''.$form->editfieldkey('Address', 'address', '', $object, 0).' ';
- print '';
- print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent');
- print ' ';
-
- // Zip / Town
- print ''.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).' browser->layout == 'phone' ? ' colspan="3"': '').'>';
- print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100');
- print ' ';
- if ($conf->browser->layout == 'phone') {
- print '';
- }
- print ''.$form->editfieldkey('Town', 'town', '', $object, 0).' browser->layout == 'phone' ? ' colspan="3"': '').'>';
- print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
- print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent');
- print ' ';
-
- // Country
- print ''.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).' ';
- print img_picto('', 'globe-americas', 'class="paddingrightonly"');
- print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 maxwidth500 widthcentpercentminusx');
- if ($user->admin) {
- print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
- }
- print ' ';
-
- // State
- if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
- if ((getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) {
- print ''.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).' ';
- } else {
- print ' '.$form->editfieldkey('State', 'state_id', '', $object, 0).' ';
- }
-
- print img_picto('', 'state', 'class="pictofixedwidth"');
- print $formcompany->select_state($object->state_id, $object->country_code);
- print ' ';
- }
-
- // Phone / Fax
- print ''.$form->editfieldkey('Phone', 'phone', GETPOST('phone', 'alpha'), $object, 0).' ';
- print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' ';
- if ($conf->browser->layout == 'phone') {
- print '';
- }
- print ''.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).' ';
- print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"').' ';
- print ' ';
-
- // Web
- print ''.$form->editfieldkey('Web', 'url', GETPOST('url', 'alpha'), $object, 0).' ';
- print ''.img_picto('', 'globe', 'class="pictofixedwidth"').' ';
-
- // EMail
- print ''.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).' ';
- print '';
- print img_picto('', 'object_email', 'class="pictofixedwidth"');
- print ' ';
- print ' ';
-
- // Unsubscribe
- if (isModEnabled('mailing')) {
- if ($conf->use_javascript_ajax && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
- print "\n".''."\n";
- }
- if (!GETPOSTISSET("no_email") && !empty($object->email)) {
- $result = $object->getNoEmail();
- if ($result < 0) {
- setEventMessages($object->error, $object->errors, 'errors');
- }
- }
- print '';
- print ''.$langs->trans("No_Email").' ';
- print '';
- $useempty = (getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
- print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty);
- print ' ';
- print ' ';
- }
-
- // Social network
- if (isModEnabled('socialnetworks')) {
- $object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4));
- }
-
- // Prof ids
- $i = 1;
- $j = 0;
- $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2);
- while ($i <= 6) {
- $idprof = $langs->transcountry('ProfId'.$i, $object->country_code);
- if ($idprof != '-') {
- $key = 'idprof'.$i;
-
- if (($j % $NBCOLS) == 0) {
- print '';
- }
-
- $idprof_mandatory = 'SOCIETE_IDPROF'.($i).'_MANDATORY';
- print ''.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', !(empty($conf->global->$idprof_mandatory) || !$object->isACompany())).' ';
- print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code);
+ // Supplier
+ if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire')))
+ || (isModEnabled('supplier_proposal') && $user->hasRight('supplier_proposal', 'lire'))) {
+ print ' ';
+ print ''.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).' ';
+ print '';
+ print $form->selectyesno("fournisseur", $object->fournisseur, 1, false, 0, 1);
print ' ';
- if (($j % $NBCOLS) == ($NBCOLS - 1)) {
- print ' ';
+ if ($conf->browser->layout == 'phone') {
+ print '';
}
- $j++;
- }
- $i++;
- }
- if ($NBCOLS > 0 && $j % 2 == 1) {
- print ' ';
- }
-
- // VAT is used
- print ''.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).' ';
- print ' tva_assuj ? 'checked="checked"': '') . ' value="1">';
- print ' ';
-
- // Local Taxes
- //TODO: Place into a function to control showing by country or study better option
- if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
- print ''.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).' ';
- print ' localtax1_assuj ? 'checked="checked"' : '') . ' value="1">';
- if (!isOnlyOneLocalTax(1)) {
- print ' '.$langs->transcountry("Type", $mysoc->country_code).': ';
- $formcompany->select_localtax(1, $object->localtax1_value, "lt1");
- print ' ';
- }
- print ' ';
- print '';
- print ''.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).' ';
- print ' localtax2_assuj ? 'checked="checked"' : '') . ' value="1"> ';
- if (!isOnlyOneLocalTax(2)) {
- print ' '.$langs->transcountry("Type", $mysoc->country_code).': ';
- $formcompany->select_localtax(2, $object->localtax2_value, "lt2");
- print ' ';
- }
- print '';
- } elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") {
- print ''.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).' ';
- print ' localtax1_assuj ? 'checked="checked"' : '') . ' value="1">';
- if (!isOnlyOneLocalTax(1)) {
- print ' '.$langs->transcountry("Type", $mysoc->country_code).': ';
- $formcompany->select_localtax(1, $object->localtax1_value, "lt1");
- print ' ';
- }
- print ' ';
- } elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") {
- print ''.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).' ';
- print ' localtax2_assuj ? 'checked="checked"' : '') . ' value="1">';
- if (!isOnlyOneLocalTax(2)) {
- print ' '.$langs->transcountry("Type", $mysoc->country_code).': ';
- $formcompany->select_localtax(2, $object->localtax2_value, "lt2");
- print ' ';
- }
- print ' ';
- }
-
- // VAT reverse charge by default
- if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
- print '' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . ' ';
- print ' vat_reverse_charge == '1' ? ' checked' : '').'>';
- print ' ';
- }
-
- // VAT Code
- print ''.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).' ';
- print '';
- $s = ' ';
-
- if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) {
- $s .= ' ';
-
- if ($conf->use_javascript_ajax) {
- $widthpopup = 600;
- if (!empty($conf->dol_use_jmobile)) {
- $widthpopup = 350;
+ print ' ';
+ if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
+ print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0);
}
- $heightpopup = 400;
- print "\n";
- print '';
- print "\n";
- $s .= ''.$langs->trans("VATIntraCheck").' ';
- $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1);
- } else {
- $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').' ';
+ print ' ';
+ $s = $modCodeFournisseur->getToolTip($langs, $object, 1);
+ print $form->textwithpicto('', $s, 1);
+ print '
';
+ print '';
}
- }
- print $s;
- print '';
- print '';
- // Type - Workforce/Staff
- print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).' browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>';
- print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1);
- if ($user->admin) {
- print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
- }
- if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) {
+ // Barcode
+ if (isModEnabled('barcode')) {
+ print ' '.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).' ';
+ print '';
+ print img_picto('', 'barcode');
+ print ' ';
+ print ' ';
+ }
+
+ // Status
+ print ''.$form->editfieldkey('Status', 'status', '', $object, 0).' ';
+ print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status, 0, 0, 0, '', 0, 0, 0, '', 'minwidth100', 1);
+ print ' ';
+
+ // Address
+ print ''.$form->editfieldkey('Address', 'address', '', $object, 0).' ';
+ print '';
+ print $form->widgetForTranslation("address", $object, $permissiontoadd, 'textarea', 'alphanohtml', 'quatrevingtpercent');
+ print ' ';
+
+ // Zip / Town
+ print ''.$form->editfieldkey('Zip', 'zipcode', '', $object, 0).' browser->layout == 'phone' ? ' colspan="3"': '').'>';
+ print $formcompany->select_ziptown($object->zip, 'zipcode', array('town', 'selectcountry_id', 'state_id'), 0, 0, '', 'maxwidth100');
print ' ';
if ($conf->browser->layout == 'phone') {
print '';
}
- print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).' ';
- print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1);
+ print ' '.$form->editfieldkey('Town', 'town', '', $object, 0).' browser->layout == 'phone' ? ' colspan="3"': '').'>';
+ print $formcompany->select_ziptown($object->town, 'town', array('zipcode', 'selectcountry_id', 'state_id'));
+ print $form->widgetForTranslation("town", $object, $permissiontoadd, 'string', 'alphanohtml', 'maxwidth100 quatrevingtpercent');
+ print ' ';
+
+ // Country
+ print ''.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).' ';
+ print img_picto('', 'globe-americas', 'class="paddingrightonly"');
+ print $form->select_country((GETPOSTISSET('country_id') ? GETPOST('country_id') : $object->country_id), 'country_id', '', 0, 'minwidth300 maxwidth500 widthcentpercentminusx');
if ($user->admin) {
print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
- } else {
- print ' ';
- }
- print ' ';
+ print '';
- // Juridical type
- print ''.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).' ';
- print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code');
- print ' ';
+ // State
+ if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
+ if ((getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 1 || getDolGlobalInt('MAIN_SHOW_REGION_IN_STATE_SELECT') == 2)) {
+ print ''.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).' ';
+ } else {
+ print ' '.$form->editfieldkey('State', 'state_id', '', $object, 0).' ';
+ }
- // Capital
- print ' '.$form->editfieldkey('Capital', 'capital', '', $object, 0).' ';
- print ' '.$langs->trans("Currency".$object->multicurrency_code).' ';
- } else {
- print '"> '.$langs->trans("Currency".$conf->currency).' ';
- }
+ print img_picto('', 'state', 'class="pictofixedwidth"');
+ print $formcompany->select_state($object->state_id, $object->country_code);
+ print '';
+ }
- // Default language
- if (getDolGlobalInt('MAIN_MULTILANGS')) {
- print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).' '."\n";
- print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language($object->default_lang, 'default_lang', 0, null, '1', 0, 0, 'maxwidth300 widthcentpercentminusx');
+ // Phone / Fax
+ print ' '.$form->editfieldkey('Phone', 'phone', GETPOST('phone', 'alpha'), $object, 0).' ';
+ print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning', 'class="pictofixedwidth"').' ';
+ if ($conf->browser->layout == 'phone') {
+ print '';
+ }
+ print ''.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).' ';
+ print 'browser->layout == 'phone' ? ' colspan="3"': '').'>'.img_picto('', 'object_phoning_fax', 'class="pictofixedwidth"').' ';
+ print ' ';
+
+ // Web
+ print ''.$form->editfieldkey('Web', 'url', GETPOST('url', 'alpha'), $object, 0).' ';
+ print ''.img_picto('', 'globe', 'class="pictofixedwidth"').' ';
+
+ // EMail
+ print ''.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).' ';
+ print '';
+ print img_picto('', 'object_email', 'class="pictofixedwidth"');
+ print ' ';
+ print ' ';
+
+ // Unsubscribe
+ if (isModEnabled('mailing')) {
+ if ($conf->use_javascript_ajax && getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2) {
+ print "\n".''."\n";
+ }
+ if (!GETPOSTISSET("no_email") && !empty($object->email)) {
+ $result = $object->getNoEmail();
+ if ($result < 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
+ print '';
+ print ''.$langs->trans("No_Email").' ';
+ print '';
+ $useempty = (getDolGlobalInt('MAILING_CONTACT_DEFAULT_BULK_STATUS') == 2);
+ print $form->selectyesno('no_email', (GETPOSTISSET("no_email") ? GETPOST("no_email", 'int') : $object->no_email), 1, false, $useempty);
+ print ' ';
+ print ' ';
+ }
+
+ // Social network
+ if (isModEnabled('socialnetworks')) {
+ $object->showSocialNetwork($socialnetworks, ($conf->browser->layout == 'phone' ? 2 : 4));
+ }
+
+ // Prof ids
+ $i = 1;
+ $j = 0;
+ $NBCOLS = ($conf->browser->layout == 'phone' ? 1 : 2);
+ while ($i <= 6) {
+ $idprof = $langs->transcountry('ProfId'.$i, $object->country_code);
+ if ($idprof != '-') {
+ $key = 'idprof'.$i;
+
+ if (($j % $NBCOLS) == 0) {
+ print '';
+ }
+
+ $idprof_mandatory = 'SOCIETE_IDPROF'.($i).'_MANDATORY';
+ print ''.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', !(empty($conf->global->$idprof_mandatory) || !$object->isACompany())).' ';
+ print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code);
+ print ' ';
+ if (($j % $NBCOLS) == ($NBCOLS - 1)) {
+ print ' ';
+ }
+ $j++;
+ }
+ $i++;
+ }
+ if ($NBCOLS > 0 && $j % 2 == 1) {
+ print ' ';
+ }
+
+ // VAT is used
+ print ''.$form->editfieldkey('VATIsUsed', 'assujtva_value', '', $object, 0).' ';
+ print ' tva_assuj ? 'checked="checked"': '') . ' value="1">';
+ print ' ';
+
+ // Local Taxes
+ //TODO: Place into a function to control showing by country or study better option
+ if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
+ print ''.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).' ';
+ print ' localtax1_assuj ? 'checked="checked"' : '') . ' value="1">';
+ if (!isOnlyOneLocalTax(1)) {
+ print ' '.$langs->transcountry("Type", $mysoc->country_code).': ';
+ $formcompany->select_localtax(1, $object->localtax1_value, "lt1");
+ print ' ';
+ }
+ print ' ';
+ print '';
+ print ''.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).' ';
+ print ' localtax2_assuj ? 'checked="checked"' : '') . ' value="1"> ';
+ if (!isOnlyOneLocalTax(2)) {
+ print ' '.$langs->transcountry("Type", $mysoc->country_code).': ';
+ $formcompany->select_localtax(2, $object->localtax2_value, "lt2");
+ print ' ';
+ }
+ print '';
+ } elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") {
+ print ''.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).' ';
+ print ' localtax1_assuj ? 'checked="checked"' : '') . ' value="1">';
+ if (!isOnlyOneLocalTax(1)) {
+ print ' '.$langs->transcountry("Type", $mysoc->country_code).': ';
+ $formcompany->select_localtax(1, $object->localtax1_value, "lt1");
+ print ' ';
+ }
+ print ' ';
+ } elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") {
+ print ''.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).' ';
+ print ' localtax2_assuj ? 'checked="checked"' : '') . ' value="1">';
+ if (!isOnlyOneLocalTax(2)) {
+ print ' '.$langs->transcountry("Type", $mysoc->country_code).': ';
+ $formcompany->select_localtax(2, $object->localtax2_value, "lt2");
+ print ' ';
+ }
+ print ' ';
+ }
+
+ // VAT reverse charge by default
+ if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
+ print '' . $form->editfieldkey('VATReverseChargeByDefault', 'vat_reverse_charge', '', $object, 0) . ' ';
+ print ' vat_reverse_charge == '1' ? ' checked' : '').'>';
+ print ' ';
+ }
+
+ // VAT Code
+ print ''.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).' ';
+ print '';
+ $s = ' ';
+
+ if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) {
+ $s .= ' ';
+
+ if ($conf->use_javascript_ajax) {
+ $widthpopup = 600;
+ if (!empty($conf->dol_use_jmobile)) {
+ $widthpopup = 350;
+ }
+ $heightpopup = 400;
+ print "\n";
+ print '';
+ print "\n";
+ $s .= ''.$langs->trans("VATIntraCheck").' ';
+ $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1);
+ } else {
+ $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').' ';
+ }
+ }
+ print $s;
print ' ';
print ' ';
- }
- // Incoterms
- if (isModEnabled('incoterm')) {
- print '';
- print ''.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).' ';
- print '';
- print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''));
- print ' ';
- }
-
- // Categories
- if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
- // Customer
- print ''.$form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0).' ';
- print '';
- $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1);
- $c = new Categorie($db);
- $cats = $c->containing($object->id, Categorie::TYPE_CUSTOMER);
- $arrayselected = array();
- foreach ($cats as $cat) {
- $arrayselected[] = $cat->id;
+ // Type - Workforce/Staff
+ print ' '.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).' browser->layout == 'phone' || !empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) ? ' colspan="3"' : '').'>';
+ print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), '', 1);
+ if ($user->admin) {
+ print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
}
- print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
- print " ";
+ if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) {
+ print '';
+ if ($conf->browser->layout == 'phone') {
+ print '';
+ }
+ print ''.$form->editfieldkey('Workforce', 'effectif_id', '', $object, 0).' ';
+ print $form->selectarray("effectif_id", $formcompany->effectif_array(0), $object->effectif_id, 0, 0, 0, '', 0, 0, 0, '', '', 1);
+ if ($user->admin) {
+ print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1);
+ }
+ } else {
+ print ' ';
+ }
+ print ' ';
- // Supplier
- if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
- print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).' ';
+ // Juridical type
+ print ''.$form->editfieldkey('JuridicalStatus', 'forme_juridique_code', '', $object, 0).' ';
+ print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code');
+ print ' ';
+
+ // Capital
+ print ''.$form->editfieldkey('Capital', 'capital', '', $object, 0).' ';
+ print ' '.$langs->trans("Currency".$object->multicurrency_code).' ';
+ } else {
+ print '"> '.$langs->trans("Currency".$conf->currency).' ';
+ }
+
+ // Default language
+ if (getDolGlobalInt('MAIN_MULTILANGS')) {
+ print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).' '."\n";
+ print img_picto('', 'language', 'class="pictofixedwidth"').$formadmin->select_language($object->default_lang, 'default_lang', 0, null, '1', 0, 0, 'maxwidth300 widthcentpercentminusx');
+ print ' ';
+ print ' ';
+ }
+
+ // Incoterms
+ if (isModEnabled('incoterm')) {
+ print '';
+ print ''.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).' ';
+ print '';
+ print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''));
+ print ' ';
+ }
+
+ // Categories
+ if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
+ // Customer
+ print ''.$form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0).' ';
print '';
- $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1);
+ $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1);
$c = new Categorie($db);
- $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER);
+ $cats = $c->containing($object->id, Categorie::TYPE_CUSTOMER);
$arrayselected = array();
foreach ($cats as $cat) {
$arrayselected[] = $cat->id;
}
- print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('suppcats', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
+ print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('custcats', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
print " ";
+
+ // Supplier
+ if ((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) {
+ print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).' ';
+ print '';
+ $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1);
+ $c = new Categorie($db);
+ $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER);
+ $arrayselected = array();
+ foreach ($cats as $cat) {
+ $arrayselected[] = $cat->id;
+ }
+ print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('suppcats', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
+ print " ";
+ }
}
- }
- // Multicurrency
- if (isModEnabled("multicurrency")) {
- print '';
- print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).' ';
- print '';
- print img_picto('', 'currency', 'class="pictofixedwidth"');
- print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code') : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)), 'multicurrency_code', 1, '', false, 'maxwidth150 widthcentpercentminusx');
- print ' ';
- }
+ // Multicurrency
+ if (isModEnabled("multicurrency")) {
+ print '';
+ print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).' ';
+ print '';
+ print img_picto('', 'currency', 'class="pictofixedwidth"');
+ print $form->selectMultiCurrency((GETPOSTISSET('multicurrency_code') ? GETPOST('multicurrency_code') : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency)), 'multicurrency_code', 1, '', false, 'maxwidth150 widthcentpercentminusx');
+ print ' ';
+ }
- // Other attributes
- $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
+ // Other attributes
+ $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
- // Parent company
- if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) {
- print '';
- print ''.$langs->trans('ParentCompany').' ';
- print '';
- print img_picto('', 'company', 'class="pictofixedwidth"');
- print $form->select_company(GETPOST('parent_company_id') ? GETPOST('parent_company_id') : $object->parent, 'parent_company_id', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
- print ' ';
- }
+ // Parent company
+ if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) {
+ print '';
+ print ''.$langs->trans('ParentCompany').' ';
+ print '';
+ print img_picto('', 'company', 'class="pictofixedwidth"');
+ print $form->select_company(GETPOST('parent_company_id') ? GETPOST('parent_company_id') : $object->parent, 'parent_company_id', '', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300 maxwidth500 widthcentpercentminusxx');
+ print ' ';
+ }
- // Webservices url/key
- if (!empty($conf->syncsupplierwebservices->enabled)) {
- print ''.$form->editfieldkey('WebServiceURL', 'webservices_url', '', $object, 0).' ';
- print ' ';
- print ''.$form->editfieldkey('WebServiceKey', 'webservices_key', '', $object, 0).' ';
- print ' ';
- }
+ // Webservices url/key
+ if (!empty($conf->syncsupplierwebservices->enabled)) {
+ print ''.$form->editfieldkey('WebServiceURL', 'webservices_url', '', $object, 0).' ';
+ print ' ';
+ print ''.$form->editfieldkey('WebServiceKey', 'webservices_key', '', $object, 0).' ';
+ print ' ';
+ }
- // Logo
- print '';
- print ''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).' ';
- print '';
- if ($object->logo) {
- print $form->showphoto('societe', $object);
- }
- $caneditfield = 1;
- if ($caneditfield) {
+ // Logo
+ print ' ';
+ print ''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).' ';
+ print '';
if ($object->logo) {
- print " \n";
+ print $form->showphoto('societe', $object);
}
- print '';
- if ($object->logo) {
- print ' '.$langs->trans("Delete").' ';
+ $caneditfield = 1;
+ if ($caneditfield) {
+ if ($object->logo) {
+ print " \n";
+ }
+ print '';
}
- //print ''.$langs->trans("PhotoFile").' ';
- print '';
- $maxfilesizearray = getMaxFileSizeArray();
- $maxmin = $maxfilesizearray['maxmin'];
- if ($maxmin > 0) {
- print ' '; // MAX_FILE_SIZE must precede the field type=file
+ print ' ';
+ print ' ';
+
+ // Assign sale representative
+ print '';
+ print ''.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).' ';
+ print '';
+ $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1);
+ $arrayselected = GETPOST('commercial', 'array');
+ if (empty($arrayselected)) {
+ $arrayselected = $object->getSalesRepresentatives($user, 1);
}
- print ' ';
+ print img_picto('', 'user', 'class="pictofixedwidth"').$form->multiselectarray('commercial', $userlist, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1);
print ' ';
+
print '
';
- }
- print ' ';
- print ' ';
- // Assign sale representative
- print '';
- print ''.$form->editfieldkey('AllocateCommercial', 'commercial_id', '', $object, 0).' ';
- print '';
- $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, 'AND u.statut = 1', 0, '', '', 0, 1);
- $arrayselected = GETPOST('commercial', 'array');
- if (empty($arrayselected)) {
- $arrayselected = $object->getSalesRepresentatives($user, 1);
- }
- print img_picto('', 'user', 'class="pictofixedwidth"').$form->multiselectarray('commercial', $userlist, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0, '', '', '', 1);
- print ' ';
+ if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
+ print ' ';
+ print '';
+ if (isModEnabled('accounting')) {
+ // Accountancy_code_sell
+ print ''.$langs->trans("ProductAccountancySellCode").' ';
+ print '';
+ print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1);
+ print ' ';
- if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
- print ' ';
- print '';
+ // Accountancy_code_buy
+ print ''.$langs->trans("ProductAccountancyBuyCode").' ';
+ print '';
+ print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1);
+ print ' ';
+ } else { // For external software
+ // Accountancy_code_sell
+ print ''.$langs->trans("ProductAccountancySellCode").' ';
+ print ' ';
+ print ' ';
- if (isModEnabled('accounting')) {
- // Accountancy_code_sell
- print ''.$langs->trans("ProductAccountancySellCode").' ';
- print '';
- print $formaccounting->select_account($object->accountancy_code_sell, 'accountancy_code_sell', 1, '', 1, 1);
- print ' ';
-
- // Accountancy_code_buy
- print ''.$langs->trans("ProductAccountancyBuyCode").' ';
- print '';
- print $formaccounting->select_account($object->accountancy_code_buy, 'accountancy_code_buy', 1, '', 1, 1);
- print ' ';
- } else { // For external software
- // Accountancy_code_sell
- print ''.$langs->trans("ProductAccountancySellCode").' ';
- print ' ';
- print ' ';
-
- // Accountancy_code_buy
- print ''.$langs->trans("ProductAccountancyBuyCode").' ';
- print ' ';
- print ' ';
+ // Accountancy_code_buy
+ print ''.$langs->trans("ProductAccountancyBuyCode").' ';
+ print ' ';
+ print ' ';
+ }
+ print '
';
}
- print '
';
}
print '
';
@@ -2615,467 +2627,472 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio
dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom');
+ // Call Hook tabContentViewThirdparty
+ $parameters = array();
+ // Note that $action and $object may be modified by hook
+ $reshook = $hookmanager->executeHooks('tabContentViewThirdparty', $parameters, $object, $action);
+ if (empty($reshook)) {
+ print '';
+ print '
';
- print '
';
- print '
';
+ print '
';
+ print '
';
- print '
';
- print '';
+ // Type Prospect/Customer/Supplier
+ print ''.$langs->trans('NatureOfThirdParty').' ';
+ print $object->getTypeUrl(1);
+ print ' ';
- // Type Prospect/Customer/Supplier
- print ''.$langs->trans('NatureOfThirdParty').' ';
- print $object->getTypeUrl(1);
- print ' ';
-
- // Prefix
- if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
- print ''.$langs->trans('Prefix').' '.dol_escape_htmltag($object->prefix_comm).' ';
- print ' ';
- }
-
- // Customer code
- if ($object->client) {
- print '';
- print $langs->trans('CustomerCode');
- print ' ';
- print '';
- print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
- $tmpcheck = $object->check_codeclient();
- if ($tmpcheck != 0 && $tmpcheck != -5) {
- print ' ('.$langs->trans("WrongCustomerCode").') ';
- }
- print ' ';
- print ' ';
- }
-
- // Supplier code
- if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) && $object->fournisseur) {
- print '';
- print $langs->trans('SupplierCode').' ';
- print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
- $tmpcheck = $object->check_codefournisseur();
- if ($tmpcheck != 0 && $tmpcheck != -5) {
- print ' ('.$langs->trans("WrongSupplierCode").') ';
- }
- print ' ';
- print ' ';
- }
-
- // Barcode
- if (isModEnabled('barcode')) {
- print '';
- print $langs->trans('Gencod').' '.showValueWithClipboardCPButton(dol_escape_htmltag($object->barcode));
- print ' ';
- print ' ';
- }
-
- // Prof ids
- $i = 1; $j = 0;
- while ($i <= 6) {
- $idprof = $langs->transcountry('ProfId'.$i, $object->country_code);
- if ($idprof != '-') {
- //if (($j % 2) == 0) print '';
- print ' ';
- print ''.$idprof.' ';
- $key = 'idprof'.$i;
- print dol_print_profids($object->$key, 'ProfId'.$i, $object->country_code, 1);
- if ($object->$key) {
- if ($object->id_prof_check($i, $object) > 0) {
- if (!empty($object->id_prof_url($i, $object))) {
- print ' '.$object->id_prof_url($i, $object);
- }
- } else {
- print ' ('.$langs->trans("ErrorWrongValue").') ';
- }
- }
- print ' ';
- //if (($j % 2) == 1) print ' ';
+ // Prefix
+ if (!empty($conf->global->SOCIETE_USEPREFIX)) { // Old not used prefix field
+ print ''.$langs->trans('Prefix').' '.dol_escape_htmltag($object->prefix_comm).' ';
print ' ';
- $j++;
}
- $i++;
- }
- //if ($j % 2 == 1) print ' ';
-
- // This fields are used to know VAT to include in an invoice when the thirdparty is making a sale, so when it is a supplier.
- // We don't need them into customer profile.
- // Except for spain and localtax where localtax depends on buyer and not seller
-
- if ($object->fournisseur) {
- // VAT is used
- print '';
- print $form->textwithpicto($langs->trans('VATIsUsed'), $langs->trans('VATIsUsedWhenSelling'));
- print ' ';
- print yn($object->tva_assuj);
- print ' ';
- print ' ';
-
- if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
- // VAT reverse charge by default
+ // Customer code
+ if ($object->client) {
print '';
- print $form->textwithpicto($langs->trans('VATReverseChargeByDefault'), $langs->trans('VATReverseChargeByDefaultDesc'));
- print ' ';
- print ' vat_reverse_charge == '1' ? ' checked' : '') . ' disabled>';
+ print $langs->trans('CustomerCode');
+ print ' ';
+ print '';
+ print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_client));
+ $tmpcheck = $object->check_codeclient();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongCustomerCode").') ';
+ }
print ' ';
print ' ';
}
- }
- // Local Taxes
- if ($object->fournisseur || $mysoc->country_code == 'ES') {
- if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
- print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).' ';
- print yn($object->localtax1_assuj);
- print ' '.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).' ';
- print yn($object->localtax2_assuj);
- print ' ';
-
- if ($object->localtax1_assuj == "1" && (!isOnlyOneLocalTax(1))) {
- print '';
- }
- if ($object->localtax2_assuj == "1" && (!isOnlyOneLocalTax(2))) {
- print '';
- }
- } elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") {
- print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).' ';
- print yn($object->localtax1_assuj);
- print ' ';
- if ($object->localtax1_assuj == "1" && (!isOnlyOneLocalTax(1))) {
- print '';
- }
- } elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") {
- print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).' ';
- print yn($object->localtax2_assuj);
- print ' ';
- if ($object->localtax2_assuj == "1" && (!isOnlyOneLocalTax(2))) {
- print '';
- }
- }
- }
-
- // Sale tax code (VAT code)
- print '';
- print ''.$langs->trans('VATIntra').' ';
- if ($object->tva_intra) {
- $s = '';
- $s .= dol_print_profids($object->tva_intra, 'VAT', $object->country_code, 1);
- $s .= ' ';
-
- if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) {
- $s .= ' ';
-
- if ($conf->use_javascript_ajax) {
- $widthpopup = 600;
- if (!empty($conf->dol_use_jmobile)) {
- $widthpopup = 350;
- }
- $heightpopup = 400;
- print "\n";
- print '';
- print "\n";
- $s .= ''.$langs->trans("VATIntraCheck").' ';
- $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1);
- } else {
- $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').' ';
- }
- }
- print $s;
- } else {
- print ' ';
- }
- print ' ';
-
- // Warehouse
- if (isModEnabled('stock') && !empty($conf->global->SOCIETE_ASK_FOR_WAREHOUSE)) {
- $langs->load('stocks');
- require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
- $formproduct = new FormProduct($db);
- print '';
- print '';
- print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $user->hasRight('societe', 'creer'));
- print ' ';
- if ($action == 'editwarehouse') {
- $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'fk_warehouse', 1);
- } else {
- if ($object->fk_warehouse > 0) {
- print img_picto('', 'stock', 'class="paddingrightonly"');
- }
- $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'none');
- }
- print ' ';
- print ' ';
- }
-
- print '
';
- print '';
-
- print '';
-
- print '
';
- print '
';
-
- // Tags / categories
- if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
- // Customer
- if ($object->prospect || $object->client || !empty($conf->global->THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT)) {
- print ''.$langs->trans("CustomersCategoriesShort").' ';
- print '';
- print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1);
- print " ";
- }
-
- // Supplier
+ // Supplier code
if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) && $object->fournisseur) {
- print ''.$langs->trans("SuppliersCategoriesShort").' ';
- print '';
- print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1);
- print " ";
- }
- }
-
-
- // Third-Party Type
- print '';
- print '';
- print ' ';
- $html_name = ($action == 'editthirdpartytype') ? 'typent_id' : 'none';
- $formcompany->formThirdpartyType($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->typent_id, $html_name, '');
- print ' ';
-
- // Workforce/Staff
- if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) {
- print ''.$langs->trans("Workforce").' '.$object->effectif.' ';
- }
-
- // Legal
- print ''.$langs->trans('JuridicalStatus').' '.$object->forme_juridique.' ';
-
- // Capital
- print ''.$langs->trans('Capital').' ';
- if ($object->capital) {
- if (isModEnabled("multicurrency") && !empty($object->multicurrency_code)) {
- print price($object->capital, '', $langs, 0, -1, -1, $object->multicurrency_code);
- } else {
- print price($object->capital, '', $langs, 0, -1, -1, $conf->currency);
- }
- } else {
- print ' ';
- }
- print ' ';
-
- // Unsubscribe opt-out
- if (isModEnabled('mailing')) {
- $result = $object->getNoEmail();
- if ($result < 0) {
- setEventMessages($object->error, $object->errors, 'errors');
- }
- print ''.$langs->trans("No_Email").' ';
- if ($object->email) {
- print yn($object->no_email);
- } else {
- print ''.$langs->trans("EMailNotDefined").' ';
+ print ' ';
+ print $langs->trans('SupplierCode').' ';
+ print showValueWithClipboardCPButton(dol_escape_htmltag($object->code_fournisseur));
+ $tmpcheck = $object->check_codefournisseur();
+ if ($tmpcheck != 0 && $tmpcheck != -5) {
+ print ' ('.$langs->trans("WrongSupplierCode").') ';
+ }
+ print ' ';
+ print ' ';
}
- $langs->load("mails");
- print ' '.$object->getNbOfEMailings().' ';
-
- print '';
- }
-
- // Default language
- if (getDolGlobalInt('MAIN_MULTILANGS')) {
- require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
- print ''.$langs->trans("DefaultLang").' ';
- //$s=picto_from_langcode($object->default_lang);
- //print ($s?$s.' ':'');
- $langs->load("languages");
- $labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : '');
- print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"');
- print $labellang;
- print ' ';
- }
-
- // Incoterms
- if (isModEnabled('incoterm')) {
- print '';
- print ''.$langs->trans('IncotermLabel').' ';
- if ($action != 'editincoterm' && $user->hasRight('societe', 'creer')) {
- print 'id.'&action=editincoterm&token='.newToken().'">'.img_edit('', 1).' ';
+ // Barcode
+ if (isModEnabled('barcode')) {
+ print '';
+ print $langs->trans('Gencod').' '.showValueWithClipboardCPButton(dol_escape_htmltag($object->barcode));
+ print ' ';
+ print ' ';
}
- print '
';
- print ' ';
- if ($action != 'editincoterm') {
- print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
- } else {
- print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?socid='.$object->id);
- }
- print ' ';
- }
- // Multicurrency
- if (isModEnabled("multicurrency")) {
+ // Prof ids
+ $i = 1; $j = 0;
+ while ($i <= 6) {
+ $idprof = $langs->transcountry('ProfId'.$i, $object->country_code);
+ if ($idprof != '-') {
+ //if (($j % 2) == 0) print '';
+ print ' ';
+ print ''.$idprof.' ';
+ $key = 'idprof'.$i;
+ print dol_print_profids($object->$key, 'ProfId'.$i, $object->country_code, 1);
+ if ($object->$key) {
+ if ($object->id_prof_check($i, $object) > 0) {
+ if (!empty($object->id_prof_url($i, $object))) {
+ print ' '.$object->id_prof_url($i, $object);
+ }
+ } else {
+ print ' ('.$langs->trans("ErrorWrongValue").') ';
+ }
+ }
+ print ' ';
+ //if (($j % 2) == 1) print ' ';
+ print '';
+ $j++;
+ }
+ $i++;
+ }
+ //if ($j % 2 == 1) print ' ';
+
+
+ // This fields are used to know VAT to include in an invoice when the thirdparty is making a sale, so when it is a supplier.
+ // We don't need them into customer profile.
+ // Except for spain and localtax where localtax depends on buyer and not seller
+
+ if ($object->fournisseur) {
+ // VAT is used
+ print '';
+ print $form->textwithpicto($langs->trans('VATIsUsed'), $langs->trans('VATIsUsedWhenSelling'));
+ print ' ';
+ print yn($object->tva_assuj);
+ print ' ';
+ print ' ';
+
+ if (!empty($conf->global->ACCOUNTING_FORCE_ENABLE_VAT_REVERSE_CHARGE)) {
+ // VAT reverse charge by default
+ print '';
+ print $form->textwithpicto($langs->trans('VATReverseChargeByDefault'), $langs->trans('VATReverseChargeByDefaultDesc'));
+ print ' ';
+ print ' vat_reverse_charge == '1' ? ' checked' : '') . ' disabled>';
+ print ' ';
+ print ' ';
+ }
+ }
+
+ // Local Taxes
+ if ($object->fournisseur || $mysoc->country_code == 'ES') {
+ if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") {
+ print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).' ';
+ print yn($object->localtax1_assuj);
+ print ' '.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).' ';
+ print yn($object->localtax2_assuj);
+ print ' ';
+
+ if ($object->localtax1_assuj == "1" && (!isOnlyOneLocalTax(1))) {
+ print '';
+ }
+ if ($object->localtax2_assuj == "1" && (!isOnlyOneLocalTax(2))) {
+ print '';
+ }
+ } elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") {
+ print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).' ';
+ print yn($object->localtax1_assuj);
+ print ' ';
+ if ($object->localtax1_assuj == "1" && (!isOnlyOneLocalTax(1))) {
+ print '';
+ }
+ } elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") {
+ print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).' ';
+ print yn($object->localtax2_assuj);
+ print ' ';
+ if ($object->localtax2_assuj == "1" && (!isOnlyOneLocalTax(2))) {
+ print '';
+ }
+ }
+ }
+
+ // Sale tax code (VAT code)
print '';
- print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).' ';
- print '';
- print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code, 1) : '';
- print ' ';
- }
+ print ''.$langs->trans('VATIntra').' ';
+ if ($object->tva_intra) {
+ $s = '';
+ $s .= dol_print_profids($object->tva_intra, 'VAT', $object->country_code, 1);
+ $s .= ' ';
- if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
- // Accountancy sell code
- print ' ';
- print $langs->trans("ProductAccountancySellCode");
- print ' ';
- if (isModEnabled('accounting')) {
- if (!empty($object->accountancy_code_sell)) {
- $accountingaccount = new AccountingAccount($db);
- $accountingaccount->fetch('', $object->accountancy_code_sell, 1);
+ if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) {
+ $s .= ' ';
- print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
+ if ($conf->use_javascript_ajax) {
+ $widthpopup = 600;
+ if (!empty($conf->dol_use_jmobile)) {
+ $widthpopup = 350;
+ }
+ $heightpopup = 400;
+ print "\n";
+ print '';
+ print "\n";
+ $s .= ''.$langs->trans("VATIntraCheck").' ';
+ $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1);
+ } else {
+ $s .= 'country_id).'" class="hideonsmartphone" target="_blank" rel="noopener noreferrer">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').' ';
+ }
}
+ print $s;
} else {
- print $object->accountancy_code_sell;
+ print ' ';
}
print ' ';
- // Accountancy buy code
- print '';
- print $langs->trans("ProductAccountancyBuyCode");
- print ' ';
- if (isModEnabled('accounting')) {
- if (!empty($object->accountancy_code_buy)) {
- $accountingaccount2 = new AccountingAccount($db);
- $accountingaccount2->fetch('', $object->accountancy_code_buy, 1);
-
- print $accountingaccount2->getNomUrl(0, 1, 1, '', 1);
+ // Warehouse
+ if (isModEnabled('stock') && !empty($conf->global->SOCIETE_ASK_FOR_WAREHOUSE)) {
+ $langs->load('stocks');
+ require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
+ $formproduct = new FormProduct($db);
+ print ' ';
+ print '';
+ print $form->editfieldkey("Warehouse", 'warehouse', '', $object, $user->hasRight('societe', 'creer'));
+ print ' ';
+ if ($action == 'editwarehouse') {
+ $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'fk_warehouse', 1);
+ } else {
+ if ($object->fk_warehouse > 0) {
+ print img_picto('', 'stock', 'class="paddingrightonly"');
+ }
+ $formproduct->formSelectWarehouses($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_warehouse, 'none');
}
- } else {
- print $object->accountancy_code_buy;
+ print ' ';
+ print ' ';
}
- print '';
- }
- // Other attributes
- $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
- include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
+ print '
';
+ print '
';
- // Parent company
- if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) {
+ print '';
+
+ print '
';
+ print '
';
+
+ // Tags / categories
+ if (isModEnabled('categorie') && $user->hasRight('categorie', 'lire')) {
+ // Customer
+ if ($object->prospect || $object->client || !empty($conf->global->THIRDPARTY_CAN_HAVE_CUSTOMER_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT)) {
+ print ''.$langs->trans("CustomersCategoriesShort").' ';
+ print '';
+ print $form->showCategories($object->id, Categorie::TYPE_CUSTOMER, 1);
+ print " ";
+ }
+
+ // Supplier
+ if (((isModEnabled("fournisseur") && $user->hasRight('fournisseur', 'lire') && empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || (isModEnabled("supplier_order") && $user->hasRight('supplier_order', 'lire')) || (isModEnabled("supplier_invoice") && $user->hasRight('supplier_invoice', 'lire'))) && $object->fournisseur) {
+ print ''.$langs->trans("SuppliersCategoriesShort").' ';
+ print '';
+ print $form->showCategories($object->id, Categorie::TYPE_SUPPLIER, 1);
+ print " ";
+ }
+ }
+
+
+ // Third-Party Type
print '';
- print ''.$langs->trans('ParentCompany').' ';
- if ($action != 'editparentcompany' && $user->hasRight('societe', 'creer')) {
- print 'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).' ';
+ print '';
print '';
- $html_name = ($action == 'editparentcompany') ? 'parent_id' : 'none';
- $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, $html_name, '', 1, 0, 0, null, 0, array($object->id));
+ $html_name = ($action == 'editthirdpartytype') ? 'typent_id' : 'none';
+ $formcompany->formThirdpartyType($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->typent_id, $html_name, '');
print ' ';
- }
- // Sales representative
- include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
+ // Workforce/Staff
+ if (empty($conf->global->SOCIETE_DISABLE_WORKFORCE)) {
+ print ''.$langs->trans("Workforce").' '.$object->effectif.' ';
+ }
- // Module Adherent
- if (isModEnabled('adherent')) {
- $langs->load("members");
- print ''.$langs->trans("LinkedToDolibarrMember").' ';
- print '';
- $adh = new Adherent($db);
- $result = $adh->fetch('', '', $object->id);
- if ($result > 0) {
- $adh->ref = $adh->getFullName($langs);
- print $adh->getNomUrl(-1);
+ // Legal
+ print ' '.$langs->trans('JuridicalStatus').' '.$object->forme_juridique.' ';
+
+ // Capital
+ print ''.$langs->trans('Capital').' ';
+ if ($object->capital) {
+ if (isModEnabled("multicurrency") && !empty($object->multicurrency_code)) {
+ print price($object->capital, '', $langs, 0, -1, -1, $object->multicurrency_code);
+ } else {
+ print price($object->capital, '', $langs, 0, -1, -1, $conf->currency);
+ }
} else {
- print ''.$langs->trans("ThirdpartyNotLinkedToMember").' ';
+ print ' ';
}
- print " \n";
- }
+ print '';
- // Link user (you must create a contact to get a user)
- /*
- print ''.$langs->trans("DolibarrLogin").' ';
- if ($object->user_id) {
- $dolibarr_user = new User($db);
- $result = $dolibarr_user->fetch($object->user_id);
- print $dolibarr_user->getLoginUrl(-1);
- } else {
- //print ''.$langs->trans("NoDolibarrAccess").' ';
- if (!$object->user_id && $user->hasRight('user', 'user', 'creer')) {
- print ''.img_picto($langs->trans("CreateDolibarrLogin"), 'add').' '.$langs->trans("CreateDolibarrLogin").' ';
+ // Unsubscribe opt-out
+ if (isModEnabled('mailing')) {
+ $result = $object->getNoEmail();
+ if ($result < 0) {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ print ' '.$langs->trans("No_Email").' ';
+ if ($object->email) {
+ print yn($object->no_email);
+ } else {
+ print ''.$langs->trans("EMailNotDefined").' ';
+ }
+
+ $langs->load("mails");
+ print ' '.$object->getNbOfEMailings().' ';
+
+ print ' ';
}
+
+ // Default language
+ if (getDolGlobalInt('MAIN_MULTILANGS')) {
+ require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+ print ''.$langs->trans("DefaultLang").' ';
+ //$s=picto_from_langcode($object->default_lang);
+ //print ($s?$s.' ':'');
+ $langs->load("languages");
+ $labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : '');
+ print picto_from_langcode($object->default_lang, 'class="paddingrightonly saturatemedium opacitylow"');
+ print $labellang;
+ print ' ';
+ }
+
+ // Incoterms
+ if (isModEnabled('incoterm')) {
+ print '';
+ print '';
+ print ' ';
+ if ($action != 'editincoterm') {
+ print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1);
+ } else {
+ print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?socid='.$object->id);
+ }
+ print ' ';
+ }
+
+ // Multicurrency
+ if (isModEnabled("multicurrency")) {
+ print '';
+ print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).' ';
+ print '';
+ print !empty($object->multicurrency_code) ? currency_name($object->multicurrency_code, 1) : '';
+ print ' ';
+ }
+
+ if (!empty($conf->global->ACCOUNTANCY_USE_PRODUCT_ACCOUNT_ON_THIRDPARTY)) {
+ // Accountancy sell code
+ print '';
+ print $langs->trans("ProductAccountancySellCode");
+ print ' ';
+ if (isModEnabled('accounting')) {
+ if (!empty($object->accountancy_code_sell)) {
+ $accountingaccount = new AccountingAccount($db);
+ $accountingaccount->fetch('', $object->accountancy_code_sell, 1);
+
+ print $accountingaccount->getNomUrl(0, 1, 1, '', 1);
+ }
+ } else {
+ print $object->accountancy_code_sell;
+ }
+ print ' ';
+
+ // Accountancy buy code
+ print '';
+ print $langs->trans("ProductAccountancyBuyCode");
+ print ' ';
+ if (isModEnabled('accounting')) {
+ if (!empty($object->accountancy_code_buy)) {
+ $accountingaccount2 = new AccountingAccount($db);
+ $accountingaccount2->fetch('', $object->accountancy_code_buy, 1);
+
+ print $accountingaccount2->getNomUrl(0, 1, 1, '', 1);
+ }
+ } else {
+ print $object->accountancy_code_buy;
+ }
+ print ' ';
+ }
+
+ // Other attributes
+ $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3');
+ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
+
+ // Parent company
+ if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) {
+ print '';
+ print '';
+ print ' ';
+ $html_name = ($action == 'editparentcompany') ? 'parent_id' : 'none';
+ $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, $html_name, '', 1, 0, 0, null, 0, array($object->id));
+ print ' ';
+ }
+
+ // Sales representative
+ include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php';
+
+ // Module Adherent
+ if (isModEnabled('adherent')) {
+ $langs->load("members");
+ print ''.$langs->trans("LinkedToDolibarrMember").' ';
+ print '';
+ $adh = new Adherent($db);
+ $result = $adh->fetch('', '', $object->id);
+ if ($result > 0) {
+ $adh->ref = $adh->getFullName($langs);
+ print $adh->getNomUrl(-1);
+ } else {
+ print ''.$langs->trans("ThirdpartyNotLinkedToMember").' ';
+ }
+ print " \n";
+ }
+
+ // Link user (you must create a contact to get a user)
+ /*
+ print ''.$langs->trans("DolibarrLogin").' ';
+ if ($object->user_id) {
+ $dolibarr_user = new User($db);
+ $result = $dolibarr_user->fetch($object->user_id);
+ print $dolibarr_user->getLoginUrl(-1);
+ } else {
+ //print ''.$langs->trans("NoDolibarrAccess").' ';
+ if (!$object->user_id && $user->hasRight('user', 'user', 'creer')) {
+ print ''.img_picto($langs->trans("CreateDolibarrLogin"), 'add').' '.$langs->trans("CreateDolibarrLogin").' ';
+ }
+ }
+ print ' ';
+ */
+
+ // Webservices url/key
+ if (!empty($conf->syncsupplierwebservices->enabled)) {
+ print ''.$langs->trans("WebServiceURL").' '.dol_print_url($object->webservices_url).' ';
+ print ''.$langs->trans('WebServiceKey').' '.$object->webservices_key.' ';
+ }
+
+ print '
';
+ print '';
+
+ print '';
+ print '
';
}
- print ' ';
- */
-
- // Webservices url/key
- if (!empty($conf->syncsupplierwebservices->enabled)) {
- print ''.$langs->trans("WebServiceURL").' '.dol_print_url($object->webservices_url).' ';
- print ''.$langs->trans('WebServiceKey').' '.$object->webservices_key.' ';
- }
-
- print '
';
- print '
';
-
- print '';
- print '
';
print dol_get_fiche_end();
diff --git a/htdocs/theme/common/flags/flag-sprite.png b/htdocs/theme/common/flags/flag-sprite.png
new file mode 100644
index 00000000000..af4822a05e8
Binary files /dev/null and b/htdocs/theme/common/flags/flag-sprite.png differ
diff --git a/htdocs/theme/eldy/flags-sprite.inc.php b/htdocs/theme/eldy/flags-sprite.inc.php
new file mode 100644
index 00000000000..99e0b241761
--- /dev/null
+++ b/htdocs/theme/eldy/flags-sprite.inc.php
@@ -0,0 +1,1279 @@
+
+/*