@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | |
| 152 | 152 | $object->fields = dol_sort_array($object->fields, 'position'); |
| 153 | 153 | $arrayfields = dol_sort_array($arrayfields, 'position'); |
| 154 | -'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
| 154 | +'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan |
|
| 155 | 155 | |
| 156 | 156 | // Security check |
| 157 | 157 | $expeditionid = GETPOSTINT('id'); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $TFactThirdNbLines = array(); |
| 233 | 233 | |
| 234 | 234 | $nb_bills_created = 0; |
| 235 | - $lastid= 0; |
|
| 235 | + $lastid = 0; |
|
| 236 | 236 | $lastref = ''; |
| 237 | 237 | |
| 238 | 238 | $db->begin(); |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | if ($search_type_thirdparty != '' && $search_type_thirdparty > 0) { |
| 553 | 553 | $param .= '&search_type_thirdparty='.urlencode($search_type_thirdparty); |
| 554 | 554 | } |
| 555 | - if ($search_datedelivery_start) { |
|
| 555 | + if ($search_datedelivery_start) { |
|
| 556 | 556 | $param .= '&search_datedelivery_startday='.urlencode(dol_print_date($search_datedelivery_start, '%d')).'&search_datedelivery_startmonth='.urlencode(dol_print_date($search_datedelivery_start, '%m')).'&search_datedelivery_startyear='.urlencode(dol_print_date($search_datedelivery_start, '%Y')); |
| 557 | 557 | } |
| 558 | 558 | if ($search_datedelivery_end) { |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | if ($searchCategoryCustomerOperator == 0) { |
| 791 | 791 | $searchCategoryCustomerSqlList[] = " EXISTS (SELECT cs.fk_soc FROM ".MAIN_DB_PREFIX."categorie_societe as cs WHERE s.rowid = cs.fk_soc AND cs.fk_categorie = ".((int) $searchCategoryCustomer).")"; |
| 792 | 792 | } else { |
| 793 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryCustomer); |
|
| 793 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryCustomer); |
|
| 794 | 794 | } |
| 795 | 795 | } |
| 796 | 796 | } |
@@ -820,7 +820,7 @@ discard block |
||
| 820 | 820 | if ($searchCategoryProductOperator == 0) { |
| 821 | 821 | $searchCategoryProductSqlList[] = " EXISTS (SELECT ck.fk_product FROM ".MAIN_DB_PREFIX."categorie_product as ck, ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd WHERE ed.fk_expedition = e.rowid AND ed.fk_elementdet = cd.rowid AND cd.fk_product = ck.fk_product AND ck.fk_categorie = ".((int) $searchCategoryProduct).")"; |
| 822 | 822 | } else { |
| 823 | - $listofcategoryid .= ($listofcategoryid ? ', ' : '') .((int) $searchCategoryProduct); |
|
| 823 | + $listofcategoryid .= ($listofcategoryid ? ', ' : '').((int) $searchCategoryProduct); |
|
| 824 | 824 | } |
| 825 | 825 | } |
| 826 | 826 | } |
@@ -441,8 +441,10 @@ |
||
| 441 | 441 | ); |
| 442 | 442 | if ($result > 0) { |
| 443 | 443 | $lineid = $result; |
| 444 | - if (!empty($createbills_onebythird)) //increment rang to keep sending |
|
| 444 | + if (!empty($createbills_onebythird)) { |
|
| 445 | + //increment rang to keep sending |
|
| 445 | 446 | $TFactThirdNbLines[$expd->socid]++; |
| 447 | + } |
|
| 446 | 448 | } else { |
| 447 | 449 | $lineid = 0; |
| 448 | 450 | $error++; |
@@ -12,131 +12,131 @@ |
||
| 12 | 12 | |
| 13 | 13 | class Microsoft extends AbstractService |
| 14 | 14 | { |
| 15 | - const SCOPE_BASIC = 'basic'; |
|
| 16 | - const SCOPE_OFFLINE_ACCESS = 'offline_access'; |
|
| 17 | - const SCOPE_SIGNIN = 'signin'; |
|
| 18 | - const SCOPE_BIRTHDAY = 'birthday'; |
|
| 19 | - const SCOPE_CALENDARS = 'calendars'; |
|
| 20 | - const SCOPE_CALENDARS_UPDATE = 'calendars_update'; |
|
| 21 | - const SCOPE_CONTACTS_BIRTHDAY = 'contacts_birthday'; |
|
| 22 | - const SCOPE_CONTACTS_CREATE = 'contacts_create'; |
|
| 23 | - const SCOPE_CONTACTS_CALENDARS = 'contacts_calendars'; |
|
| 24 | - const SCOPE_CONTACTS_PHOTOS = 'contacts_photos'; |
|
| 25 | - const SCOPE_CONTACTS_SKYDRIVE = 'contacts_skydrive'; |
|
| 26 | - const SCOPE_EMAIL = 'email'; |
|
| 27 | - const SCOPE_EVENTS_CREATE = 'events_create'; |
|
| 28 | - const SCOPE_MESSENGER = 'messenger'; |
|
| 29 | - const SCOPE_OPENID = 'openid'; |
|
| 30 | - const SCOPE_PHONE_NUMBERS = 'phone_numbers'; |
|
| 31 | - const SCOPE_PHOTOS = 'photos'; |
|
| 32 | - const SCOPE_POSTAL_ADDRESSES = 'postal_addresses'; |
|
| 33 | - const SCOPE_PROFILE = 'profile'; |
|
| 34 | - const SCOPE_SHARE = 'share'; |
|
| 35 | - const SCOPE_SKYDRIVE = 'skydrive'; |
|
| 36 | - const SCOPE_SKYDRIVE_UPDATE = 'skydrive_update'; |
|
| 37 | - const SCOPE_WORK_PROFILE = 'work_profile'; |
|
| 38 | - const SCOPE_APPLICATIONS = 'applications'; |
|
| 39 | - const SCOPE_APPLICATIONS_CREATE = 'applications_create'; |
|
| 40 | - const SCOPE_IMAP = 'imap'; |
|
| 41 | - const SCOPE_IMAP_ACCESSASUSERALL = 'https://outlook.office.com/.default'; |
|
| 42 | - const SCOPE_SMTPSEND = 'https://outlook.office.com/.default'; |
|
| 43 | - const SCOPE_USERREAD = 'User.Read'; |
|
| 44 | - const SCOPE_MAILREAD = 'Mail.Read'; |
|
| 45 | - const SCOPE_MAILSEND = 'Mail.Send'; |
|
| 46 | - |
|
| 47 | - protected $storage; |
|
| 48 | - |
|
| 49 | - |
|
| 50 | - /** |
|
| 51 | - * MS uses some magical not officialy supported scope to get even moar info like full emailaddresses. |
|
| 52 | - * They agree that giving 3rd party apps access to 3rd party emailaddresses is a pretty lame thing to do so in all |
|
| 53 | - * their wisdom they added this scope because fuck you that's why. |
|
| 54 | - * |
|
| 55 | - * https://github.com/Lusitanian/PHPoAuthLib/issues/214 |
|
| 56 | - * http://social.msdn.microsoft.com/Forums/live/en-US/c6dcb9ab-aed4-400a-99fb-5650c393a95d/how-retrieve-users- |
|
| 57 | - * contacts-email-address?forum=messengerconnect |
|
| 58 | - * |
|
| 59 | - * Considering this scope is not officially supported: use with care |
|
| 60 | - */ |
|
| 61 | - const SCOPE_CONTACTS_EMAILS = 'contacts_emails'; |
|
| 62 | - |
|
| 63 | - |
|
| 64 | - public function __construct( |
|
| 65 | - CredentialsInterface $credentials, |
|
| 66 | - ClientInterface $httpClient, |
|
| 67 | - TokenStorageInterface $storage, |
|
| 68 | - $scopes = array(), |
|
| 69 | - UriInterface $baseApiUri = null |
|
| 70 | - ) { |
|
| 71 | - parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); |
|
| 72 | - |
|
| 73 | - $this->storage = $storage; |
|
| 74 | - |
|
| 75 | - if (null === $baseApiUri) { |
|
| 76 | - $this->baseApiUri = new Uri('https://apis.live.net/v5.0/'); |
|
| 77 | - } |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * {@inheritdoc} |
|
| 82 | - */ |
|
| 83 | - public function getAuthorizationEndpoint() |
|
| 84 | - { |
|
| 85 | - $tenant = $this->storage->getTenant(); |
|
| 86 | - |
|
| 87 | - //return new Uri('https://login.live.com/oauth20_authorize.srf'); |
|
| 88 | - //return new Uri('https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize'); |
|
| 89 | - return new Uri('https://login.microsoftonline.com/'.$tenant.'/oauth2/v2.0/authorize'); |
|
| 90 | - } |
|
| 91 | - |
|
| 92 | - /** |
|
| 93 | - * {@inheritdoc} |
|
| 94 | - */ |
|
| 95 | - public function getAccessTokenEndpoint() |
|
| 96 | - { |
|
| 97 | - $tenant = $this->storage->getTenant(); |
|
| 98 | - |
|
| 99 | - //return new Uri('https://login.live.com/oauth20_token.srf'); |
|
| 100 | - //return new Uri('https://login.microsoftonline.com/organizations/oauth2/v2.0/token'); |
|
| 101 | - return new Uri('https://login.microsoftonline.com/'.$tenant.'/oauth2/v2.0/token'); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - /** |
|
| 105 | - * {@inheritdoc} |
|
| 106 | - */ |
|
| 107 | - public function getAuthorizationMethod() |
|
| 108 | - { |
|
| 109 | - return static::AUTHORIZATION_METHOD_QUERY_STRING; |
|
| 110 | - } |
|
| 111 | - |
|
| 112 | - /** |
|
| 113 | - * {@inheritdoc} |
|
| 114 | - */ |
|
| 115 | - protected function parseAccessTokenResponse($responseBody) |
|
| 116 | - { |
|
| 117 | - $data = json_decode($responseBody, true); |
|
| 118 | - |
|
| 119 | - if (null === $data || !is_array($data)) { |
|
| 120 | - throw new TokenResponseException('Unable to parse response.'); |
|
| 121 | - } elseif (isset($data['error'])) { |
|
| 122 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 123 | - } |
|
| 124 | - //print $data['access_token'];exit; |
|
| 125 | - |
|
| 126 | - $token = new StdOAuth2Token(); |
|
| 127 | - $token->setAccessToken($data['access_token']); |
|
| 128 | - $token->setLifetime($data['expires_in']); |
|
| 129 | - |
|
| 130 | - if (isset($data['refresh_token'])) { |
|
| 131 | - $token->setRefreshToken($data['refresh_token']); |
|
| 132 | - unset($data['refresh_token']); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - unset($data['access_token']); |
|
| 136 | - unset($data['expires_in']); |
|
| 137 | - |
|
| 138 | - $token->setExtraParams($data); |
|
| 139 | - |
|
| 140 | - return $token; |
|
| 141 | - } |
|
| 15 | + const SCOPE_BASIC = 'basic'; |
|
| 16 | + const SCOPE_OFFLINE_ACCESS = 'offline_access'; |
|
| 17 | + const SCOPE_SIGNIN = 'signin'; |
|
| 18 | + const SCOPE_BIRTHDAY = 'birthday'; |
|
| 19 | + const SCOPE_CALENDARS = 'calendars'; |
|
| 20 | + const SCOPE_CALENDARS_UPDATE = 'calendars_update'; |
|
| 21 | + const SCOPE_CONTACTS_BIRTHDAY = 'contacts_birthday'; |
|
| 22 | + const SCOPE_CONTACTS_CREATE = 'contacts_create'; |
|
| 23 | + const SCOPE_CONTACTS_CALENDARS = 'contacts_calendars'; |
|
| 24 | + const SCOPE_CONTACTS_PHOTOS = 'contacts_photos'; |
|
| 25 | + const SCOPE_CONTACTS_SKYDRIVE = 'contacts_skydrive'; |
|
| 26 | + const SCOPE_EMAIL = 'email'; |
|
| 27 | + const SCOPE_EVENTS_CREATE = 'events_create'; |
|
| 28 | + const SCOPE_MESSENGER = 'messenger'; |
|
| 29 | + const SCOPE_OPENID = 'openid'; |
|
| 30 | + const SCOPE_PHONE_NUMBERS = 'phone_numbers'; |
|
| 31 | + const SCOPE_PHOTOS = 'photos'; |
|
| 32 | + const SCOPE_POSTAL_ADDRESSES = 'postal_addresses'; |
|
| 33 | + const SCOPE_PROFILE = 'profile'; |
|
| 34 | + const SCOPE_SHARE = 'share'; |
|
| 35 | + const SCOPE_SKYDRIVE = 'skydrive'; |
|
| 36 | + const SCOPE_SKYDRIVE_UPDATE = 'skydrive_update'; |
|
| 37 | + const SCOPE_WORK_PROFILE = 'work_profile'; |
|
| 38 | + const SCOPE_APPLICATIONS = 'applications'; |
|
| 39 | + const SCOPE_APPLICATIONS_CREATE = 'applications_create'; |
|
| 40 | + const SCOPE_IMAP = 'imap'; |
|
| 41 | + const SCOPE_IMAP_ACCESSASUSERALL = 'https://outlook.office.com/.default'; |
|
| 42 | + const SCOPE_SMTPSEND = 'https://outlook.office.com/.default'; |
|
| 43 | + const SCOPE_USERREAD = 'User.Read'; |
|
| 44 | + const SCOPE_MAILREAD = 'Mail.Read'; |
|
| 45 | + const SCOPE_MAILSEND = 'Mail.Send'; |
|
| 46 | + |
|
| 47 | + protected $storage; |
|
| 48 | + |
|
| 49 | + |
|
| 50 | + /** |
|
| 51 | + * MS uses some magical not officialy supported scope to get even moar info like full emailaddresses. |
|
| 52 | + * They agree that giving 3rd party apps access to 3rd party emailaddresses is a pretty lame thing to do so in all |
|
| 53 | + * their wisdom they added this scope because fuck you that's why. |
|
| 54 | + * |
|
| 55 | + * https://github.com/Lusitanian/PHPoAuthLib/issues/214 |
|
| 56 | + * http://social.msdn.microsoft.com/Forums/live/en-US/c6dcb9ab-aed4-400a-99fb-5650c393a95d/how-retrieve-users- |
|
| 57 | + * contacts-email-address?forum=messengerconnect |
|
| 58 | + * |
|
| 59 | + * Considering this scope is not officially supported: use with care |
|
| 60 | + */ |
|
| 61 | + const SCOPE_CONTACTS_EMAILS = 'contacts_emails'; |
|
| 62 | + |
|
| 63 | + |
|
| 64 | + public function __construct( |
|
| 65 | + CredentialsInterface $credentials, |
|
| 66 | + ClientInterface $httpClient, |
|
| 67 | + TokenStorageInterface $storage, |
|
| 68 | + $scopes = array(), |
|
| 69 | + UriInterface $baseApiUri = null |
|
| 70 | + ) { |
|
| 71 | + parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri); |
|
| 72 | + |
|
| 73 | + $this->storage = $storage; |
|
| 74 | + |
|
| 75 | + if (null === $baseApiUri) { |
|
| 76 | + $this->baseApiUri = new Uri('https://apis.live.net/v5.0/'); |
|
| 77 | + } |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * {@inheritdoc} |
|
| 82 | + */ |
|
| 83 | + public function getAuthorizationEndpoint() |
|
| 84 | + { |
|
| 85 | + $tenant = $this->storage->getTenant(); |
|
| 86 | + |
|
| 87 | + //return new Uri('https://login.live.com/oauth20_authorize.srf'); |
|
| 88 | + //return new Uri('https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize'); |
|
| 89 | + return new Uri('https://login.microsoftonline.com/'.$tenant.'/oauth2/v2.0/authorize'); |
|
| 90 | + } |
|
| 91 | + |
|
| 92 | + /** |
|
| 93 | + * {@inheritdoc} |
|
| 94 | + */ |
|
| 95 | + public function getAccessTokenEndpoint() |
|
| 96 | + { |
|
| 97 | + $tenant = $this->storage->getTenant(); |
|
| 98 | + |
|
| 99 | + //return new Uri('https://login.live.com/oauth20_token.srf'); |
|
| 100 | + //return new Uri('https://login.microsoftonline.com/organizations/oauth2/v2.0/token'); |
|
| 101 | + return new Uri('https://login.microsoftonline.com/'.$tenant.'/oauth2/v2.0/token'); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + /** |
|
| 105 | + * {@inheritdoc} |
|
| 106 | + */ |
|
| 107 | + public function getAuthorizationMethod() |
|
| 108 | + { |
|
| 109 | + return static::AUTHORIZATION_METHOD_QUERY_STRING; |
|
| 110 | + } |
|
| 111 | + |
|
| 112 | + /** |
|
| 113 | + * {@inheritdoc} |
|
| 114 | + */ |
|
| 115 | + protected function parseAccessTokenResponse($responseBody) |
|
| 116 | + { |
|
| 117 | + $data = json_decode($responseBody, true); |
|
| 118 | + |
|
| 119 | + if (null === $data || !is_array($data)) { |
|
| 120 | + throw new TokenResponseException('Unable to parse response.'); |
|
| 121 | + } elseif (isset($data['error'])) { |
|
| 122 | + throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 123 | + } |
|
| 124 | + //print $data['access_token'];exit; |
|
| 125 | + |
|
| 126 | + $token = new StdOAuth2Token(); |
|
| 127 | + $token->setAccessToken($data['access_token']); |
|
| 128 | + $token->setLifetime($data['expires_in']); |
|
| 129 | + |
|
| 130 | + if (isset($data['refresh_token'])) { |
|
| 131 | + $token->setRefreshToken($data['refresh_token']); |
|
| 132 | + unset($data['refresh_token']); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + unset($data['access_token']); |
|
| 136 | + unset($data['expires_in']); |
|
| 137 | + |
|
| 138 | + $token->setExtraParams($data); |
|
| 139 | + |
|
| 140 | + return $token; |
|
| 141 | + } |
|
| 142 | 142 | } |
@@ -119,7 +119,7 @@ |
||
| 119 | 119 | if (null === $data || !is_array($data)) { |
| 120 | 120 | throw new TokenResponseException('Unable to parse response.'); |
| 121 | 121 | } elseif (isset($data['error'])) { |
| 122 | - throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"'); |
|
| 122 | + throw new TokenResponseException('Error in retrieving token: "'.$data['error'].'"'); |
|
| 123 | 123 | } |
| 124 | 124 | //print $data['access_token'];exit; |
| 125 | 125 | |
@@ -281,7 +281,7 @@ |
||
| 281 | 281 | // Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth) |
| 282 | 282 | $supportedoauth2array = array( |
| 283 | 283 | 'OAUTH_GOOGLE_NAME' => array( |
| 284 | - 'callbackfile' => 'google', // used to generate the filename: google_oauthcallback.php |
|
| 284 | + 'callbackfile' => 'google', // used to generate the filename: google_oauthcallback.php |
|
| 285 | 285 | 'picto' => 'google', |
| 286 | 286 | 'urlforapp' => 'OAUTH_GOOGLE_DESC', |
| 287 | 287 | 'name' => 'Google', |