Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
58328d36
Commit
58328d36
authored
7 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
To provide solution to get thirdparty when name is not unique.
parent
3a6314b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/societe/class/societe.class.php
+11
-9
11 additions, 9 deletions
htdocs/societe/class/societe.class.php
with
11 additions
and
9 deletions
htdocs/societe/class/societe.class.php
+
11
−
9
View file @
58328d36
...
...
@@ -1004,21 +1004,22 @@ class Societe extends CommonObject
* @param int $rowid Id of third party to load
* @param string $ref Reference of third party, name (Warning, this can return several records)
* @param string $ref_ext External reference of third party (Warning, this information is a free field not provided by Dolibarr)
* @param string $ref_int Internal reference of third party
* @param string $ref_int Internal reference of third party
(not used by dolibarr)
* @param string $idprof1 Prof id 1 of third party (Warning, this can return several records)
* @param string $idprof2 Prof id 2 of third party (Warning, this can return several records)
* @param string $idprof3 Prof id 3 of third party (Warning, this can return several records)
* @param string $idprof4 Prof id 4 of third party (Warning, this can return several records)
* @param string $idprof5 Prof id 5 of third party (Warning, this can return several records)
* @param string $idprof6 Prof id 6 of third party (Warning, this can return several records)
* @param string $email Email (Warning, this can return several records)
* @return int >0 if OK, <0 if KO or if two records found for same ref or idprof, 0 if not found.
*/
function
fetch
(
$rowid
,
$ref
=
''
,
$ref_ext
=
''
,
$ref_int
=
''
,
$idprof1
=
''
,
$idprof2
=
''
,
$idprof3
=
''
,
$idprof4
=
''
,
$idprof5
=
''
,
$idprof6
=
''
)
function
fetch
(
$rowid
,
$ref
=
''
,
$ref_ext
=
''
,
$ref_int
=
''
,
$idprof1
=
''
,
$idprof2
=
''
,
$idprof3
=
''
,
$idprof4
=
''
,
$idprof5
=
''
,
$idprof6
=
''
,
$email
=
''
)
{
global
$langs
;
global
$conf
;
if
(
empty
(
$rowid
)
&&
empty
(
$ref
)
&&
empty
(
$ref_ext
)
&&
empty
(
$ref_int
)
&&
empty
(
$idprof1
)
&&
empty
(
$idprof2
)
&&
empty
(
$idprof3
)
&&
empty
(
$idprof4
)
&&
empty
(
$idprof5
)
&&
empty
(
$idprof6
))
return
-
1
;
if
(
empty
(
$rowid
)
&&
empty
(
$ref
)
&&
empty
(
$ref_ext
)
&&
empty
(
$ref_int
)
&&
empty
(
$idprof1
)
&&
empty
(
$idprof2
)
&&
empty
(
$idprof3
)
&&
empty
(
$idprof4
)
&&
empty
(
$idprof5
)
&&
empty
(
$idprof6
)
&&
empty
(
$email
)
)
return
-
1
;
$sql
=
'SELECT s.rowid, s.nom as name, s.name_alias, s.entity, s.ref_ext, s.ref_int, s.address, s.datec as date_creation, s.prefix_comm'
;
$sql
.
=
', s.status'
;
...
...
@@ -1062,6 +1063,7 @@ class Societe extends CommonObject
else
if
(
$idprof4
)
$sql
.
=
" WHERE s.idprof4 = '"
.
$this
->
db
->
escape
(
$idprof4
)
.
"' AND s.entity IN ("
.
getEntity
(
$this
->
element
,
1
)
.
")"
;
else
if
(
$idprof5
)
$sql
.
=
" WHERE s.idprof5 = '"
.
$this
->
db
->
escape
(
$idprof5
)
.
"' AND s.entity IN ("
.
getEntity
(
$this
->
element
,
1
)
.
")"
;
else
if
(
$idprof6
)
$sql
.
=
" WHERE s.idprof6 = '"
.
$this
->
db
->
escape
(
$idprof6
)
.
"' AND s.entity IN ("
.
getEntity
(
$this
->
element
,
1
)
.
")"
;
else
if
(
$email
)
$sql
.
=
" WHERE email = '"
.
$this
->
db
->
escape
(
$email
)
.
"' AND s.entity IN ("
.
getEntity
(
$this
->
element
,
1
)
.
")"
;
$resql
=
$this
->
db
->
query
(
$sql
);
dol_syslog
(
get_class
(
$this
)
.
"::fetch "
.
$sql
);
...
...
@@ -1886,7 +1888,7 @@ class Societe extends CommonObject
$label
.
=
'<u>'
.
$langs
->
trans
(
"ShowMargin"
)
.
'</u>'
;
$linkstart
=
'<a href="'
.
DOL_URL_ROOT
.
'/margin/tabs/thirdpartyMargins.php?socid='
.
$this
->
id
.
'&type=1'
;
}
// By default
if
(
empty
(
$linkstart
))
{
...
...
@@ -1907,7 +1909,7 @@ class Societe extends CommonObject
$label
.
=
'<br><b>'
.
$langs
->
trans
(
'CustomerAccountancyCode'
)
.
':</b> '
.
$this
->
code_compta_client
;
if
(
!
empty
(
$conf
->
accounting
->
enabled
)
&&
$this
->
fournisseur
)
$label
.
=
'<br><b>'
.
$langs
->
trans
(
'SupplierAccountancyCode'
)
.
':</b> '
.
$this
->
code_compta_fournisseur
;
if
(
!
empty
(
$this
->
logo
)
&&
class_exists
(
'Form'
))
{
$label
.
=
'</br><div class="photointooltip">'
;
...
...
@@ -1949,7 +1951,7 @@ class Societe extends CommonObject
$linkstart
=
''
;
$linkend
=
''
;
}
if
(
$withpicto
)
$result
.
=
(
$linkstart
.
img_object
((
$notooltip
?
''
:
$label
),
'company'
,
(
$notooltip
?
''
:
'class="classfortooltip"'
),
0
,
0
,
$notooltip
?
0
:
1
)
.
$linkend
);
if
(
$withpicto
&&
$withpicto
!=
2
)
$result
.
=
' '
;
if
(
$withpicto
!=
2
)
$result
.
=
$linkstart
.
(
$maxlen
?
dol_trunc
(
$name
,
$maxlen
)
:
$name
)
.
$linkend
;
...
...
@@ -3449,9 +3451,9 @@ class Societe extends CommonObject
return
0
;
}
}
$modelpath
=
"core/modules/societe/doc/"
;
$result
=
$this
->
commonGenerateDocument
(
$modelpath
,
$modele
,
$outputlangs
,
$hidedetails
,
$hidedesc
,
$hideref
,
$moreparams
);
}
...
...
@@ -3472,7 +3474,7 @@ class Societe extends CommonObject
public
function
setCategories
(
$categories
,
$type
)
{
require_once
DOL_DOCUMENT_ROOT
.
'/categories/class/categorie.class.php'
;
// Decode type
if
(
$type
==
'customer'
)
{
$type_id
=
Categorie
::
TYPE_CUSTOMER
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment