--show-toplevel [1ms] 2024-12-13 12:49:20.927 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 12:50:58.016 [info] > git rev-parse --show-toplevel [0ms] 2024-12-13 12:50:58.016 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 12:51:01.442 [info] > git rev-parse --show-toplevel [2ms] 2024-12-13 12:51:01.442 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 12:51:37.603 [info] > git rev-parse --show-toplevel [0ms] 2024-12-13 12:51:37.603 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 12:51:39.523 [info] > git rev-parse --show-toplevel [1ms] 2024-12-13 12:51:39.523 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 12:51:47.001 [info] > git rev-parse --show-toplevel [0ms] 2024-12-13 12:51:47.001 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 12:51:48.661 [info] > git rev-parse --show-toplevel [1ms] 2024-12-13 12:51:48.661 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 12:52:03.679 [info] > git rev-parse --show-toplevel [1ms] 2024-12-13 12:52:03.679 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 12:52:04.172 [info] > git rev-parse --show-toplevel [0ms] 2024-12-13 12:52:04.172 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 12:52:06.357 [info] > git rev-parse --show-toplevel [1ms] 2024-12-13 12:52:06.357 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 13:16:52.609 [info] > git rev-parse --show-toplevel [2ms] 2024-12-13 13:16:52.609 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 13:28:21.999 [info] > git config --get commit.template [3ms] 2024-12-13 13:28:22.000 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [1ms] 2024-12-13 13:28:22.007 [info] > git status -z -uall [4ms] 2024-12-13 13:28:22.007 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [1ms] 2024-12-13 13:28:28.965 [info] > git config --get commit.template [1ms] 2024-12-13 13:28:28.968 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [1ms] 2024-12-13 13:28:28.975 [info] > git status -z -uall [3ms] 2024-12-13 13:28:28.975 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [1ms] 2024-12-13 14:26:49.405 [info] > git config --get commit.template [1ms] 2024-12-13 14:26:49.408 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [1ms] 2024-12-13 14:26:49.414 [info] > git status -z -uall [3ms] 2024-12-13 14:26:49.414 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [1ms] 2024-12-13 14:26:54.424 [info] > git config --get commit.template [3ms] 2024-12-13 14:26:54.424 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstream:remotename)%00%(upstream:remoteref) refs/heads/master refs/remotes/master [0ms] 2024-12-13 14:26:54.430 [info] > git status -z -uall [2ms] 2024-12-13 14:26:54.430 [info] > git for-each-ref --sort -committerdate --format %(refname) %(objectname) %(*objectname) [1ms] 2024-12-13 14:27:17.879 [info] > git rev-parse --show-toplevel [2ms] 2024-12-13 14:27:17.879 [info] fatal: not a git repository (or any of the parent directories): .git 2024-12-13 14:50:07.686 [info] > git config --get commit.template [4ms] 2024-12-13 14:50:07.686 [info] > git for-each-ref --format=%(refname)%00%(upstream:short)%00%(objectname)%00%(upstream:track)%00%(upstr function formatMoney($Money) { return "$ ".number_format(sprintf('%0.2f', preg_replace("/[^0-9.]/", "", $Money)),2); } # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ # MODAL PARA MOSTRAR ERRORES # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ --> function showMessage($title, $message){ echo '
'; echo ''; } # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ # OBTENGO EL TOKEN DE BOOKS # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ function GetToken(){ $sOrganiZB = ""; if (isset($_REQUEST['pOrganiZB'])) { $sOrganiZB = $_REQUEST['pOrganiZB']; } else { echo 'Por favor introduzca el ID de la Organización de Zoho Books.'; return; } #---------------------------------------------------------------- # Creamos la conexión a la base de datos #---------------------------------------------------------------- $conn = mysqli_connect("127.0.0.1", "aptuslegal", "#Aptus2021#", "vendorbills"); if (!$conn) { echo "Error: No se pudo conectar a MySQL." . PHP_EOL; echo "errno de depuración: " . mysqli_connect_errno() . PHP_EOL; exit; } #---------------------------------------------------------------- # Traemos los valores de conexión utilizando el organizationId #---------------------------------------------------------------- $sql = 'SELECT * FROM conndetails WHERE organization_id = "' . $sOrganiZB.'"'; if($result = $conn->query($sql)) { $row = $result->fetch_assoc(); } else exit('No se ejecuto la consulta'); #---------------------------------------------------------------- # RFC de la Organización #---------------------------------------------------------------- $regFeCa = $row['rfc']; #---------------------------------------------------------------- # Variables para Zoho Books #---------------------------------------------------------------- $appOwner = $row['appOwner']; $boa_RefreshToken = $row['zbooks_rtoken']; $boa_ClientId = $row['zbooksclient_id']; $boa_ClientSecret = $row['zbooksclient_secret']; $boa_RedirectUri = $row['RedirectUri']; $boa_AuthUrl = 'https://accounts.zoho.com/oauth/v2/token'; $boa_GrantType = "refresh_token"; #---------------------------------------------------------------- # Cerramos la conexión #---------------------------------------------------------------- mysqli_close($conn); #---------------------------------------------------------------- # Obtengo el Token de Books #---------------------------------------------------------------- return oauth($appOwner, 'ZBooks', $boa_RefreshToken, $boa_ClientId, $boa_ClientSecret, $boa_RedirectUri, $boa_GrantType, $boa_AuthUrl); } # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ # USUARIO ACTIVO # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ function getUser($zbToken){ if (isset($_REQUEST['pOrganiZB'])) { $sOrganiZB = $_REQUEST['pOrganiZB']; } else { echo "Es necesario introducir el ID de la organización en Zoho Books"; } $request_url = "https://www.zohoapis.com/books/v3/users/me?organization_id=".$sOrganiZB; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $request_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Zoho-oauthtoken ' . $zbToken)); $r = curl_exec($ch); $array = json_decode($r); $user = $array->user; curl_close ($ch); //var_dump($array->user); echo 'Usuario activo: " . $user->name."
"; echo "Rol activo: " . $user->user_role."
"; echo "eMail: ".$user->email."
"; echo "Estatus: " . $user->status."
"; } # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ # BALANZA DE COMPROBACIÓN # ------------------------------------------------------------------------------------------------------------------------------------------------------------------ function getBalCom($zbToken){ $sOrganiZB = ""; if (isset($_REQUEST['pOrganiZB'])) { $sOrganiZB = $_REQUEST['pOrganiZB']; } $sAnioCat = $_POST['anio']; $sMesCat = $_POST['mes']; $sTipoEnv = $_POST['tipo']; $file_name = basename($_FILES["fileToUpload"]["name"]); $file_name = str_replace(' ', '_', $file_name); $temp_file = $_FILES["fileToUpload"]["tmp_name"]; $target_dir = "archs_csv/"; $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]); $target_file = str_replace(' ', '_', $target_file); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); if(empty($_POST['anio'])) { echo 'Por favor introduzca el Año para el proceso.'; } else if(empty($_POST['mes'])) { echo 'Por favor introduzca el Mes para el proceso.'; } else if(empty($_POST['tipo'])) { echo 'Por favor introduzca el Tipo para el proceso.'; } else if(empty($file_name)) { showMessage($title = 'Información faltante', $message = 'Por favor seleccione el archivo a procesar.'); return; } else if($sOrganiZB == "") { showMessage($title = 'Información erronea', $message = 'Por favor introduzca el ID de la Organización de Zoho Books.'); return; } else { // Check if file already exists if (file_exists($target_file)) { # showMessage($title = 'Información', $message = 'Se eliminó un archivo pre-existente con el mismo nombre.'); } // Allow certain file formats if($imageFileType != "csv" ) { showMessage($title = 'Información erronea', $message = 'El archivos debe contener el libro mayor y ser tipo CSV.'); return; } // Check if $uploadOk is set to 0 by an error if ($uploadOk == 0) { ?>message . '